﻿/**
 * Saint Aside - Angel Come AR CD
 * --------------------------------------------------------------------------------
 * Copyright (c) 2011 Peter Oberlaender, augmedia.de, wayoutofline.net
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * For further information please contact.
 *  http://www.wayoutofline.net/
 *  <pete(at)wayoutofline.net>
 * 
 */
package 
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.PixelSnapping;
	import flash.display.Sprite;
	//// STAGESCALE AND ALIGN
	import flash.display.StageScaleMode;
	import flash.display.StageAlign;
	//// FULL SCREEN
	import flash.display.StageDisplayState;
	import flash.events.MouseEvent;
	import flash.display.Stage; 
	import flash.geom.Rectangle; 
	// TWEENING ENGINE
	import caurina.transitions.*;
	import caurina.transitions.properties.ColorShortcuts;
	import caurina.transitions.properties.FilterShortcuts;
	import flash.events.Event;
	import flash.media.Camera;
	import flash.media.Video;
	import flash.net.URLLoaderDataFormat;
	import flash.utils.ByteArray;
	import flash.events.EventDispatcher;
	import flash.display.MovieClip;
	import flash.utils.Timer;
	import flash.events.TimerEvent;
	import flash.text.TextField;
	import flash.media.Video;
	import flash.net.NetConnection;
	import flash.net.NetStream;
	import flash.utils.ByteArray;
	import flash.utils.*;
	import flash.display.*;
	import flash.events.*;
	import flash.net.*;
	import flash.ui.*;
	import flash.filters.BlurFilter;
	import flash.filters.ColorMatrixFilter;
	import flash.display.Bitmap;
	import flash.geom.Point;
	import flash.media.Sound;
	import flash.system.fscommand;
	//// VIEWPORTLAYERS
	import org.papervision3d.view.layer.ViewportLayer;
	import org.papervision3d.view.layer.util.ViewportLayerSortMode;
	import jp.nyatla.as3utils.NyMultiFileLoader;
	import org.libspark.flartoolkit.core.FLARCode;
	import org.libspark.flartoolkit.core.analyzer.raster.threshold.FLARRasterThresholdAnalyzer_SlidePTile;
	import org.libspark.flartoolkit.core.param.FLARParam;
	import org.libspark.flartoolkit.core.raster.rgb.FLARRgbRaster_BitmapData;
	import org.libspark.flartoolkit.core.transmat.FLARTransMatResult;
	import org.libspark.flartoolkit.detector.FLARMultiMarkerDetector;
	import org.libspark.flartoolkit.support.pv3d.FLARBaseNode;
	import org.libspark.flartoolkit.support.pv3d.FLARCamera3D;
	import org.papervision3d.lights.PointLight3D;
	import org.papervision3d.materials.WireframeMaterial;
	import org.papervision3d.materials.shadematerials.FlatShadeMaterial;
	import org.papervision3d.materials.utils.MaterialsList;
	import org.papervision3d.objects.DisplayObject3D;
	import org.papervision3d.objects.primitives.Cube;
	import org.papervision3d.objects.primitives.Plane;
	import org.papervision3d.render.LazyRenderEngine;
	import org.papervision3d.scenes.Scene3D;
	import org.papervision3d.view.Viewport3D;
	import org.papervision3d.view.stats.StatsView;
	import org.papervision3d.materials.BitmapFileMaterial;
	import org.papervision3d.materials.MovieAssetMaterial;
	//// DAE
	import org.papervision3d.objects.parsers.DAE;
	import org.papervision3d.objects.parsers.Collada;
	import org.papervision3d.core.animation.clip.AnimationClip3D;
	import org.papervision3d.events.FileLoadEvent;
	//// PETEROBERLAENDER
	import com.peteroberlaender.mc_classes.*;
	import com.peteroberlaender.preloader.*;
	//// LIGHT PARTICLES	
	import com.flashandmath.dg.objects.Particle3D;
	//// LOADER STUFF
	import flash.display.Loader;
	import flash.display.LoaderInfo;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.net.URLLoader;
	import flash.net.URLLoaderDataFormat;
	import flash.net.URLRequest;
	import flash.system.ApplicationDomain;
	import flash.system.LoaderContext;
	import flash.utils.ByteArray;
	import flash.system.*;
	import flash.geom.ColorTransform;
	import flash.geom.Transform;
	import flash.display.Sprite;
	import flash.filters.BitmapFilterQuality;
	import flash.filters.GlowFilter;
	import org.papervision3d.materials.BitmapMaterial;
	import org.papervision3d.core.math.Matrix3D;
	import org.papervision3d.core.math.Number3D;
	/**
	 * @author Peter Oberlaender
	 *
	 */
	public class SAACCD extends Sprite
	{
		protected var canvasWidth:int;
		protected var canvasHeight:int;
		protected var captureWidth:int;
		protected var captureHeight:int;
		protected var cameraParamFile:String;
		protected var markerPatternFileList:Vector.<String>;
		protected var cameraParam:FLARParam;
		protected var markerPatternList:Vector.<FLARCode>;
		protected var codeWidthList:Vector.<Number>;
		protected var markerList:Vector.<MarkerData>;
		protected var webCamera:Camera;
		protected var video:Video;
		protected var _base:Sprite;
		private var capture:Bitmap;
		private var raster:FLARRgbRaster_BitmapData;
		private var detector:FLARMultiMarkerDetector;
		private var _threshold:int = 80;
		private var _threshold_detect:FLARRasterThresholdAnalyzer_SlidePTile;
		protected var viewport3d:Viewport3D;
		protected var scene3d:Scene3D;
		protected var camera3d:FLARCamera3D;
		protected var markerNodeList:Vector.<FLARBaseNode>;
		protected var renderer:LazyRenderEngine;
		protected var container:DisplayObject3D;
		protected var resultMat:FLARTransMatResult = new FLARTransMatResult();
		//// VARIABLES
		private var theV_1:int=0;
		private var theV_2:int=0;
		private var theV_3:int=0;
		private var theV_4:int=0;
		private var theV_5:int=0;
		private var theV_6:int=0;
		private var theV_7:int=0;
		private var theV_8:int=0;
		private var theV_9:int=0;
		private var theV_10:int=0;
		private var theV_11:int=0;
		private var theV_12:int=0;
		//// VIDEO SWF VARIABLES
		private var theV_13:int=0;
		private var theV_30:int=0;
		//// VIDEO BTNS VARIABLE
		private var theV_31:int=0;
		private var theV_32:int=0;
		private var theV_33:int=0;
		private var theV_34:int=0;
		//// LYRICS SWF VARIABLES
		private var theV_40:int=0;
		private var theV_41:int=0;
		//// GALLERY SWF VARIABLES
		private var theV_50:int=0;
		private var theV_51:int=0;
		//// AC SWF VARIABLES
		private var theV_55:int=0;
		private var theV_56:int=0;
		private var theV_70:int=0;
		private var theV_71:int=0;
		private var theV_72:int=0;
		private var theV_73:int=0;
		private var theV_74:int=0;
		private var theV_75:int=0;
		private var theV_76:int=0;
		private var theV_77:int=0;
		private var theV_78:int=0;
		private var theV_79:int=0;
		//// RESIZE
		private var _baseContainer:Sprite;
		private var picWidth:Number;
		private var picHeight:Number;
		private var pic2Width:Number;
		private var pic2Height:Number;
		//// BLENDE
		public var screenBlende:MovieClip;
		//// CORNERS
		public var cornerContainer:MovieClip;
		public var cornerTL:MovieClip;
		public var cornerTR:MovieClip;
		public var cornerBL:MovieClip;
		public var cornerBR:MovieClip;
		public var btnsPanel:MovieClip;
		public var xit:MovieClip;
		public var fScreen:MovieClip;
		public var creditsPanel:MovieClip;
		public var homeBtn:MovieClip;
		public var homeBtnTrigA:MovieClip;
		public var homeBtnTrigB:MovieClip;
		public var homeBtnTrigC:MovieClip;
		public var homeBtnTrigD:MovieClip;
		//// TRIGGERS		
		public var trig_a:MovieClip;
		public var trig_a_img:MovieClip;
		public var trig_b:MovieClip;
		public var trig_b_img:MovieClip;
		public var trig_c:MovieClip;
		public var trig_c_img:MovieClip;		
		public var trig_d:MovieClip;
		public var trig_d_img:MovieClip;
		private var trig_a_mc:MovieClip;
		private var trig_b_mc:MovieClip;
		private var trig_c_mc:MovieClip;
		private var trig_d_mc:MovieClip;		
		//// TARGETS
		private var trgt_1:MovieClip;
		private var trgt_2:MovieClip;
		private var trgt_3:MovieClip;
		private var trgt_4:MovieClip;
		//// POINTERS
		private var point_a:MovieClip;
		public var point_a_img:MovieClip;
		private var point_b:MovieClip;
		public var point_b_img:MovieClip;
		private var point_c:MovieClip;
		public var point_c_img:MovieClip;
		private var point_d:MovieClip;
		public var point_d_img:MovieClip;
		private var point_a_mc:MovieClip;
		private var point_b_mc:MovieClip;
		private var point_c_mc:MovieClip;
		private var point_d_mc:MovieClip;
		//// LOADERSIGN
		public var loadSignA:MovieClip;
		public var loadSignB:MovieClip;
		public var loadSignC:MovieClip;
		public var loadSignD:MovieClip;
		//// FIELDS
		private var field_a:MovieClip;
		public var fieldAActive:Boolean;
		public var fieldAOn:Boolean;
		private var field_b:MovieClip;
		public var fieldBActive:Boolean;
		public var fieldBOn:Boolean;
		private var field_c:MovieClip;
		public var fieldCActive:Boolean;
		public var fieldCOn:Boolean;
		private var field_d:MovieClip;
		public var fieldDActive:Boolean;
		public var fieldDOn:Boolean;
		//// VIDEO BUTTONS
		private var vidBtn_Box:MovieClip;
		private var vidBtn_A:MovieClip;
		private var vidBtn_B:MovieClip;
		public var vidBtns_On:Boolean = false;
		public var vidAActive:Boolean = false;
		public var vidBActive:Boolean = false;
		//// EXTERNAL SWF STUFF
		private var swfFileLocation:String;
		private var externalSwfLoader:Loader = new Loader();
		public var page_preloader_mc:pagePreloaderMc;
		private var swfComObject:Object;
		private var swfHolder:MovieClip;
		private var connectorSWF:MovieClip;
		private var myClip:MovieClip;
		private var myClip1:MovieClip;
		private var myClip2:MovieClip;
		private var myClip4:MovieClip;
		private var myClipReady:Boolean=false;
		//// PARTICLE LIGHTS
		const pi2:Number = Math.PI*2;
		private var displayWidth:Number;
		private var displayHeight:Number;
		private var projCenterX:Number;
		private var projCenterY:Number;
		private var theta:Number;
		private var phi:Number;
		private var dphi:Number;
		private var dtheta:Number;
		private var fLen:Number;
		private var uMax:Number;
		private var dColor:uint;
		private var cost:Number;
		private var sint:Number ;
		private var cosp:Number;
		private var sinp:Number;
		private var p:Particle3D;
		private var m:Number;
		private var numParticles:Number;
		private var bgColor:uint;
		private var blur:BlurFilter;
		private var origin:Point;
		private var darken:ColorTransform;
		private var picHolder:Sprite;
		private var displayBitmap:Bitmap;
		private var displayBitmapData:BitmapData;
		private var pic:Bitmap;
		private var picLoader:Loader;
		private var picURL:URLRequest;
		private var firstParticle:Particle3D;
		private var M11:Number;
		private var M12:Number;
		private var M31:Number;
		private var M32:Number;
		private var level:Number;
		private var readColor:uint;
		private var levelInc:Number;
		private var postColor:ColorTransform;
		private var postBlur:BlurFilter;
		private var numT:Number;
		private var numS:Number;
		private var baseRed:Number;
		private var baseGreen:Number;
		private var baseBlue:Number;
		private var lightBeamLayer:ViewportLayer;
		private var particleLayer1:ViewportLayer;
		private var plane:Plane;
		private var screenMc:Plane;
		private var screenMcMat:MovieAssetMaterial;
		private var	_modelWrapA:DisplayObject3D;
		private var	_modelWrapB:DisplayObject3D;
		private var	_modelWrapC:DisplayObject3D;
		private var	_modelWrapD:DisplayObject3D;
		private var _particleContainer:DisplayObject3D;
		private var _ampsAAdded:Boolean = false;
		private var _ampsBAdded:Boolean = false;
		private var _ampsCAdded:Boolean = false;
		private var _ampsDAdded:Boolean = false;
		private var _ampsARemoved:Boolean = true;
		private var _ampsBRemoved:Boolean = true;
		private var _ampsCRemoved:Boolean = true;
		private var _ampsDRemoved:Boolean = true;
		public var smooth:Boolean;
		public var opposite:Boolean;
		public var invisible:Boolean;
		private var shootA:Boolean=false;
		private var shootB:Boolean=false;
		private var shootC:Boolean=false;
		private var shootD:Boolean=false;
		//// SOUND
		private var my_Song:Sound;
		//// CONTEXT_MENU
		private var _menuDLSource:ContextMenu;
		//// TIMERSTUFF
		private var zaehlA:int=0;
		private var zaehlB:int=0;
		private var zaehlC:int=0;
		private var zaehlD:int=0;
		private var tcAActive:Boolean;
		private var tcBActive:Boolean;
		private var tcCActive:Boolean;
		private var tcDActive:Boolean;
		//// DELAY OFFSET
		private var CntDlay:int = 25;
		//// STAGE IS IN USE
		private var stageInUse:Boolean=false;
		private var fr_mcActive:Boolean=false;
		private var nt_mcActive:Boolean=false;
		private var pt_mcActive:Boolean=false;
		private var bs_mcActive:Boolean=false;
		private var nS_mcsActive:Boolean=false;
		//// INTRO VIDEO
		public var bgImgToLoad:String;
		public var bgLoader:flash.display.Loader;
		public var videoHolder:flash.display.MovieClip;
		public var lastBgHolder:*;
		public var sdTransform:flash.media.SoundTransform;
		public var videoVolumeTransform:flash.media.SoundTransform;
		public var videoPlaying:Boolean;
		public var bgFileType:String;
		public var buffer:flash.display.MovieClip;
		public var swfBgSelfAligns:Boolean;
		public var bgIsVideo:Boolean;
		public var bgImgRatio:Number;
		public var IntroVid:flash.media.Video;
		public var stream:flash.net.NetStream;
		public var bgPreloader:flash.display.MovieClip;
		public var connection:flash.net.NetConnection;
		public var bufferTimer:flash.utils.Timer;
		public var curBgHolder:*;
		public var videoRatio:Number;
		//// CONSTRUCTOR
		public function SAACCD()
		{
			Security.allowDomain("*");
			ColorShortcuts.init();
			FilterShortcuts.init();
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;
			this.init();
			//// FULLSCREEN PERMANENT
			FSOn();
			createSourceLink();
		}
		protected function init():void
		{
		connectStream();
			//// PAGE PRELOADER
			page_preloader_mc = new pagePreloaderMc();
			page_preloader_mc.x = 0;
			page_preloader_mc.y = 0;
			stage.addChild(page_preloader_mc);
			page_preloader_mc.visible = false;
			page_preloader_mc.alpha = 0;
		}
		public function connectStream():void
		{
			this.bgLoader = new flash.display.Loader();
			this.videoHolder = new flash.display.MovieClip();
			bgImgToLoad = "ac_videos/AC_Intro_4.flv";
			var client:Object;
			var loc1:*;
			this.connection = new flash.net.NetConnection();
			this.connection.connect(null);
			this.stream = new flash.net.NetStream(this.connection);
			this.stream.bufferTime = Number(15);
			client = new Object();
			this.stream.client = client;
			this.IntroVid = new flash.media.Video();
			this.IntroVid.attachNetStream(this.stream);
			this.IntroVid.smoothing = true;
			this.IntroVid.width = 960;
			this.IntroVid.height = 540;
			this.IntroVid.x = 0;
			this.IntroVid.y = 0;
			this.videoHolder.addChild(this.IntroVid);
			this.videoHolder.width = IntroVid.width * (stage.stageHeight / IntroVid.height);
			this.videoHolder.height = stage.stageHeight;
			videoHolder.visible = true;			
			this.stage.addChild(this.videoHolder);
			pic2Height = IntroVid.height / IntroVid.width;
			pic2Width = IntroVid.width / IntroVid.height;
			stage.addEventListener(Event.RESIZE, vidResizer);
			setBgVideoToStage();
			centerVid();
			this.videoVolumeTransform = new flash.media.SoundTransform();
			this.videoVolumeTransform.volume = Number(0.75);
			this.stream.soundTransform = this.videoVolumeTransform;
			this.stream.play(this.bgImgToLoad);
			this.addEventListener(Event.ENTER_FRAME, _IntroVidUpdate);
			return;
		}		
		private function _IntroVidUpdate(e:Event):void {
		var netClient:Object = new Object();
			if (stream.time>15){
				if (theV_70==0){
				theV_70 = theV_70+1;
				}
			}
			if (stream.time>34){
				if (theV_70==1){
					this.stream.pause();
					this.IntroVid.clear();
					this.connection.close();
					this.connection = null;
					this.stream.close();
					this.stream = null;
					this.IntroVid = null;
					this.bgIsVideo = false;
					this.videoHolder.visible = false;
					stage.removeEventListener(Event.RESIZE, vidResizer);
					FSOn();
					initConnector();
					this.removeEventListener( Event.ENTER_FRAME, this._IntroVidUpdate);
				theV_70 = theV_70+1;
				}
			}
		}
		private function setBgVideoToStage():void {
			if ((stage.stageHeight / stage.stageWidth) < pic2Height) {
				videoHolder.width = stage.stageWidth;
				videoHolder.height = pic2Height * videoHolder.width;
			} else {
				videoHolder.height = stage.stageHeight;
				videoHolder.width = pic2Width * videoHolder.height;
			};	
		}
		private function centerVid():void {
			this.videoHolder.x = stage.stageWidth / 2 - this.videoHolder.width / 2;
			this.videoHolder.y = stage.stageHeight / 2 - this.videoHolder.height / 2;
		}
		private function vidResizer(e:Event):void {
			setBgVideoToStage();
			centerVid();
		}			
		protected function initConnector():void
		{
			swfFileLocation = "connector.swf";
			loadExternalSwf();
		}
		//// INITIALIZE AR
		protected function initAR():void
		{
			this.captureWidth = 320;
			this.captureHeight = 240;
			this.canvasWidth = 640;
			this.canvasHeight = 480;
			this.cameraParamFile = 'data/camera_para.dat';
			this.markerPatternList = new Vector.<FLARCode>();
			this.markerPatternFileList = new Vector.<String>();
			this.markerPatternFileList.push('data/sl_4.pat',
											'data/ac_2.pat',
											'data/v_2.pat',
											'data/g_2.pat'
											);
			this.codeWidthList = new Vector.<Number>();
			this.codeWidthList.push( 80, 80, 80, 80);
			this.paramLoad();
			for (var i:int=0; i<markerPatternFileList.length; i++) {
			}
		}
		protected function initItems():void
		{
//////////////////////////////////////
			//// POINTER A
			point_a_mc = new MovieClip();
			stage.addChild(point_a_mc);			
			point_a = new HIT1();
			point_a_mc.addChild(point_a);
			point_a_img = new point_A_img();
			point_a_mc.addChildAt(point_a_img,1);
			point_a_img.x = -9;
			point_a_img.y = -9;
			point_a_mc.visible = false;
			Tweener.addTween(point_a_mc, {alpha:0, time:0});
			//// POINTER B
			point_b_mc = new MovieClip();
			stage.addChild(point_b_mc);			
			point_b = new HIT2();
			point_b_mc.addChild(point_b);
			point_b_img = new point_B_img();
			point_b_mc.addChildAt(point_b_img,1);
			point_b_img.x = -9;
			point_b_img.y = -9;
			point_b_mc.visible = false;
			Tweener.addTween(point_b_mc, {alpha:0, time:0});
			//// POINTER C
			point_c_mc = new MovieClip();
			stage.addChild(point_c_mc);			
			point_c = new HIT3();
			point_c_mc.addChild(point_c);
			point_c_img = new point_C_img();
			point_c_mc.addChildAt(point_c_img,1);
			point_c_img.x = -9;
			point_c_img.y = -9;
			point_c_mc.visible = false;
			Tweener.addTween(point_c_mc, {alpha:0, time:0});
			//// POINTER D
			point_d_mc = new MovieClip();
			stage.addChild(point_d_mc);			
			point_d = new HIT4();
			point_d_mc.addChild(point_d);
			point_d_img = new point_D_img();
			point_d_mc.addChildAt(point_d_img,1);
			point_d_img.x = -9;
			point_d_img.y = -9;
			point_d_mc.visible = false;
			Tweener.addTween(point_d_mc, {alpha:0, time:0});
//////////////////////////////////////
			screenBlende = new SCREEN();
			screenBlende.x = 0;
			screenBlende.y = 0;
			cornerContainer = new MovieClip;
			stage.addChildAt(cornerContainer, 1);
			cornerContainer.addChild(screenBlende);
			cornerTL = new Corner_TL();
			cornerContainer.addChild(cornerTL);
			cornerTL.x = 0;
			cornerTL.y = 0;
			cornerTR = new Corner_TR();
			cornerContainer.addChild(cornerTR);
			cornerTR.x = stage.stageWidth-714;
			cornerTR.y = 0;
			cornerBL = new Corner_BL();
			cornerContainer.addChild(cornerBL);
			cornerBL.x = 0;
			cornerBL.y = stage.stageHeight-392;
			cornerBR = new Corner_BR();
			cornerContainer.addChild(cornerBR);
			cornerBR.x = stage.stageWidth-714;
			cornerBR.y = stage.stageHeight-392;
			//// CREDITS PANEL
			creditsPanel = new CreditsPanel();
			cornerContainer.addChild(creditsPanel);
			creditsPanel.x = stage.stageWidth / 2;
			creditsPanel.y = stage.stageHeight-150;
			//// HOME BUTTON
			homeBtn = new HomeBtn();
			cornerContainer.addChild(homeBtn);
			homeBtnTrigA = new HomeBtnTrig;
			homeBtn.addChild(homeBtnTrigA);
			homeBtnTrigA.y = 5;
			homeBtnTrigA.x = 2;
			homeBtnTrigB = new HomeBtnTrig;
			homeBtn.addChild(homeBtnTrigB);
			homeBtnTrigB.y = 5;
			homeBtnTrigB.x = 2;
			homeBtnTrigC = new HomeBtnTrig;
			homeBtn.addChild(homeBtnTrigC);
			homeBtnTrigC.y = 5;
			homeBtnTrigC.x = 2;
			homeBtnTrigD = new HomeBtnTrig;
			homeBtn.addChild(homeBtnTrigD);
			homeBtnTrigD.y = 5;
			homeBtnTrigD.x = 2;
			field_a = new fieldOne();
			fieldAActive = false;
			fieldAOn = false;
			field_b = new fieldTwo();
			fieldBActive = false;
			fieldBOn = false;
			field_c = new fieldThree();
			fieldCActive = false;
			fieldCOn = false;
			field_d = new fieldFour();
			fieldDActive = false;
			fieldDOn = false;
			//// VIDEOBUTTONS
			vidBtn_Box = new MovieClip();
			vidBtn_A = new vidBtnA();
			vidBtn_Box.addChild(vidBtn_A);
			vidBtn_A.x = -175-25;
			vidBtn_A.y = -87.5;
			vidBtn_B = new vidBtnB();
			vidBtn_Box.addChild(vidBtn_B);
			vidBtn_B.x = 5+25;
			vidBtn_B.y = -87.5;
//////////////////////////////////////
			//// TRIGGER A			
			trig_a_mc = new MovieClip();
			stage.addChild(trig_a_mc);			
			trig_a = new trigA();
			trig_a.x = 15-5;
			trig_a.y = 17;
			trig_a_mc.addChild(trig_a);			
			trig_a_img = new trig_A_img() as MovieClip;
			trig_a_mc.addChildAt(trig_a_img,1);
			trig_a_img.x = 9+15-5;
			trig_a_img.y = 9+17;
			//// TRIGGER B
			trig_b_mc = new MovieClip();
			stage.addChild(trig_b_mc);
			trig_b = new trigB();
			trig_b.x = -18-3;
			trig_b.y = 17;
			trig_b_mc.addChild(trig_b);
			trig_b_img = new trig_B_img() as MovieClip;
			trig_b_mc.addChildAt(trig_b_img,1);
			trig_b_img.x = 9-18-3;
			trig_b_img.y = 9+17;
			//// TRIGGER C
			trig_c_mc = new MovieClip();
			stage.addChild(trig_c_mc);
			trig_c = new trigC();
			trig_c.x = 15-5;
			trig_c.y = -23;
			trig_c_mc.addChild(trig_c);
			trig_c_img = new trig_C_img() as MovieClip;
			trig_c_mc.addChildAt(trig_c_img,1);
			trig_c_img.x = 9+15-5;
			trig_c_img.y = 9-23;
			//// TRIGGER D
			trig_d_mc = new MovieClip();
			stage.addChild(trig_d_mc);
			trig_d = new trigD();
			trig_d.x = -18-3;
			trig_d.y = -23;
			trig_d_mc.addChild(trig_d);
			trig_d_img = new trig_D_img() as MovieClip;
			trig_d_mc.addChildAt(trig_d_img,1);
			trig_d_img.x = 9-18-3;
			trig_d_img.y = 9-23;
//////////////////////////////////////
			//// XIT
			xit = new Xit();
			xit.x = 327;
			xit.y = -192;
			cornerTR.addChildAt(xit,1);
			Tweener.addTween(xit, {alpha:0.0, time:0});
			Tweener.addTween(xit, {alpha:0.5, delay:3, time:1.5});
			xit.addEventListener(MouseEvent.MOUSE_OVER, xitOnMOver);
			xit.addEventListener(MouseEvent.MOUSE_OUT, xitOnMOut);
			xit.addEventListener(MouseEvent.CLICK, xitClickHandler);
			fScreen = new FScreen();
			fScreen.x = -352;
			fScreen.y = -192;
			cornerTL.addChildAt(fScreen,1);
			Tweener.addTween(fScreen, {alpha:0.0, time:0});
			Tweener.addTween(fScreen, {alpha:0.5, delay:3, time:1.5});
			fScreen.addEventListener(MouseEvent.MOUSE_OVER, fScreenOnMOver);
			fScreen.addEventListener(MouseEvent.MOUSE_OUT, fScreenOnMOut);
			fScreen.addEventListener(MouseEvent.CLICK, fScreenClickHandler);
			loadSignA = new LoadSign();
			loadSignA.x = 20;
			loadSignA.y = -30;
			point_a_mc.addChildAt(loadSignA,1);
			loadSignB = new LoadSign();
			loadSignB.x = 20;
			loadSignB.y = -30;
			point_b_mc.addChildAt(loadSignB,1);
			loadSignC = new LoadSign();
			loadSignC.x = 20;
			loadSignC.y = -30;
			point_c_mc.addChildAt(loadSignC,1);
			loadSignD = new LoadSign();
			loadSignD.x = 20;
			loadSignD.y = -30;
			point_d_mc.addChildAt(loadSignD,1);
			loadSignA.visible = false;
			loadSignB.visible = false;
			loadSignC.visible = false;
			loadSignD.visible = false;
			trig_a_mc.visible = false;
			trig_b_mc.visible = false;
			trig_c_mc.visible = false;
			trig_d_mc.visible = false;
			my_Song = new Sound();
			my_Song.load(new URLRequest("data/selectSound2.mp3"));
			Tweener.addTween(homeBtn, {x:0, y:stage.stageHeight/2, time:1.5, transition:"easeOutStrong"});
			Tweener.addTween(creditsPanel.PanelContent, {y:0, delay:0, time:1.5, transition:"easeOutStrong"});
			Tweener.addTween(trig_a_mc, {x:trig_a_mc.width/2, y:trig_a_mc.height/2, time:1.5, transition:"easeOutStrong"});
			Tweener.addTween(trig_b_mc, {x:stage.stageWidth - trig_b_mc.width/2, y:trig_b_mc.height/2, time:1.5, transition:"easeOutStrong"});
			Tweener.addTween(trig_c_mc, {x:trig_c_mc.width/2, y:stage.stageHeight - trig_c_mc.height/2, time:1.5, transition:"easeOutStrong"});
			Tweener.addTween(trig_d_mc, {x:stage.stageWidth - trig_d_mc.width/2, y:stage.stageHeight - trig_d_mc.height/2, time:1.5, transition:"easeOutStrong"});
			Tweener.addTween(vidBtn_A.vidGallBtn_1, {alpha:0, time:0});
			Tweener.addTween(vidBtn_B.vidGallBtn_2, {alpha:0, time:0});
			field_c.addChild(vidBtn_Box);
		}
		private function xitClickHandler(event:MouseEvent):void {
			fscommand("quit");
		}
		private function xitOnMOver(event:MouseEvent):void
		{
			Tweener.addTween(xit, {alpha:1, time:1.5, transition:"easeOutStrong"});
			return;
		}
		private function xitOnMOut(event:MouseEvent):void
		{
			Tweener.addTween(xit, {alpha:0.5, time:1.5, transition:"easeOutStrong"});
			return;
		}
		private function fScreenClickHandler(event:MouseEvent):void {
			if (stage.displayState == StageDisplayState.NORMAL) {
				try{
					stage.displayState=StageDisplayState.FULL_SCREEN;
					fscommand("fullscreen", "true");
					}
					catch (e:SecurityError){
					trace("an error has occured.");
					}
			}
			else if (stage.displayState == StageDisplayState.FULL_SCREEN) {
				try{
					stage.displayState=StageDisplayState.NORMAL;
					fscommand("fullscreen", "false");
					}
					catch (e:SecurityError){
					trace("an error has occured.");
				}
			}
		}
		private function fScreenOnMOver(event:MouseEvent):void
		{
			Tweener.addTween(fScreen, {alpha:1, time:1.5, transition:"easeOutStrong"});
			return;
		}
		private function fScreenOnMOut(event:MouseEvent):void
		{
			Tweener.addTween(fScreen, {alpha:0.5, time:1.5, transition:"easeOutStrong"});
			return;
		}
		//// RETURN VOID
		protected function paramLoad():void
		{
			var mf:NyMultiFileLoader=new NyMultiFileLoader();
			mf.addTarget(
				this.cameraParamFile, URLLoaderDataFormat.BINARY,
				function(data:ByteArray):void
				{
					cameraParam = new FLARParam();
					cameraParam.loadARParam(data);
					cameraParam.changeScreenSize(captureWidth, captureHeight);
				});
			var markerPatternCode0:FLARCode = new FLARCode(16, 16);
			mf.addTarget(
				this.markerPatternFileList[0], URLLoaderDataFormat.TEXT,
				function(data:String):void
				{
					markerPatternCode0.loadARPattFromFile(data);
				}
			);
			var markerPatternCode1:FLARCode = new FLARCode(16, 16);
			mf.addTarget(
				this.markerPatternFileList[1], URLLoaderDataFormat.TEXT,
				function(data:String):void
				{
					markerPatternCode1.loadARPattFromFile(data);
				}
			);
			var markerPatternCode2:FLARCode = new FLARCode(16, 16);
			mf.addTarget(
				this.markerPatternFileList[2], URLLoaderDataFormat.TEXT,
				function(data:String):void
				{
					markerPatternCode2.loadARPattFromFile(data);
				}
			);
			var markerPatternCode3:FLARCode = new FLARCode(16, 16);
			mf.addTarget(
				this.markerPatternFileList[3], URLLoaderDataFormat.TEXT,
				function(data:String):void
				{
					markerPatternCode3.loadARPattFromFile(data);
				}
			);
			mf.multiLoad();
			this.markerPatternList.push(markerPatternCode0);
			this.markerPatternList.push(markerPatternCode1);
			this.markerPatternList.push(markerPatternCode2);
			this.markerPatternList.push(markerPatternCode3);
			mf.addEventListener(Event.COMPLETE, initialization);
			return;
		}
		protected function FSOn():void
		{
			if (stage.displayState == StageDisplayState.NORMAL) {
				try{
					stage.displayState=StageDisplayState.FULL_SCREEN;
					fscommand("fullscreen", "true");
					}
					catch (e:SecurityError){
					trace("an error has occured.");
					}
			}
			else if (stage.displayState == StageDisplayState.FULL_SCREEN) {
				try{
					stage.displayState=StageDisplayState.NORMAL;
					fscommand("fullscreen", "false");
					}
					catch (e:SecurityError){
					trace("an error has occured.");
					}
			}
		}
		//// RETURN VOID
		private function initialization(e:Event): void
		{
			this.removeEventListener(Event.COMPLETE, initialization);
			//// SETUP CAMERA
			this.webCamera = Camera.getCamera();
			if (!this.webCamera) {
				throw new Error('No webcam!!!!');
			}
			this.webCamera.setMode( this.captureWidth, this.captureHeight, 30);
			this.video = new Video( this.captureWidth, this.captureHeight);
			this.video.attachCamera(this.webCamera);
			//// SETUP ARToolkit
			this.capture = new Bitmap(new BitmapData(this.captureWidth, this.captureHeight, false, 0),
										  PixelSnapping.AUTO,
										  true);
			this.capture.width = this.canvasWidth;
			this.capture.height = this.canvasHeight;
			this.raster = new FLARRgbRaster_BitmapData( this.capture.bitmapData);
			//// SETUP MULTIMARKERDETECTOR
			this.detector = new FLARMultiMarkerDetector( this.cameraParam,
														  this.markerPatternList,
														  this.codeWidthList,
														  this.markerPatternList.length);
			this.detector.setContinueMode(true);
			this._threshold_detect=new FLARRasterThresholdAnalyzer_SlidePTile(15,4);
			dispatchEvent(new Event(Event.INIT));
			this.supportLibsInit();
			mirror = !mirror;
			this.start();
		}
		protected function supportLibsInit(): void
		{
			_base = addChild(new Sprite()) as Sprite;
			_base.addChild(capture);
			_base.width = 640;
			_base.height = 480;
			_baseContainer = addChild(new Sprite()) as Sprite;
			_baseContainer.addChild(_base);
			_baseContainer.width = 640;
			_baseContainer.height = 480;
			picHeight = _baseContainer.height / _baseContainer.width;
			picWidth = _baseContainer.width / _baseContainer.height;
			stage.addEventListener(Event.RESIZE, resizeListener);
			scaleProportional();
			centerPic();
			trig_a_mc.visible = true;
			trig_b_mc.visible = true;
			trig_c_mc.visible = true;
			trig_d_mc.visible = true;
			//// SETUP 3D			
			this.viewport3d = _base.addChild(new Viewport3D(320, 240)) as Viewport3D;
			this.viewport3d.scaleX = this.canvasWidth / this.captureWidth;
			this.viewport3d.scaleY = this.canvasHeight / this.captureHeight;
			this.viewport3d.x = 0;
			viewport3d.containerSprite.sortMode = ViewportLayerSortMode.ORIGIN_SORT;
			this.scene3d = new Scene3D();
			this.markerNodeList = new Vector.<FLARBaseNode>();
			this.markerList = new Vector.<MarkerData>();
			for (var i:int=0; i<this.markerPatternList.length; i++) {
				this.markerList.push(new MarkerData(i));
				this.markerList[i].confidence = 0;
				this.markerNodeList[i] = new FLARBaseNode();
				this.scene3d.addChild(this.markerNodeList[i]);
			}
			//// SETUP 3D
			this.camera3d = new FLARCamera3D(this.cameraParam);
			//// SETUP RENDERER
			this.renderer = new LazyRenderEngine(this.scene3d, this.camera3d, this.viewport3d);
		}
////////////////////////////////////////////////////////////////////////////////////////////////		
////////////////////////////////////////////////////////////////////////////////////////////////		
		//// 3D OBJECTS
		protected function createObject(_lightColor:Number,_ambientColor:Number):DisplayObject3D
		{
			var wmat:WireframeMaterial = new WireframeMaterial(_lightColor, 1, 2);
			var _plane:Plane = new Plane(wmat, 80, 80);
			_plane.rotationX = 180;
			var light:PointLight3D = new PointLight3D();
			light.x = 0;
			light.y = 1000;
			light.z = -1000;
			var fmat:FlatShadeMaterial = new FlatShadeMaterial(light, _lightColor, _ambientColor);
			var _cube:Cube = new Cube(new MaterialsList( { all:fmat } ), 40, 40, 40);
			_cube.z = 20;
			var _container:DisplayObject3D = new DisplayObject3D();
			_container.addChild(_plane);
			_container.addChild(_cube);
			return _container;
		}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//// PARTICLES	
	protected function lightBeamInit():void
	{
		levelInc = 32;
		displayWidth = 380;
		displayHeight = 380;
		projCenterX = displayWidth/2;
		projCenterY = displayHeight/2;
		theta = 3*Math.PI/2;
		phi = -Math.PI/4;
		dphi = Math.PI/208;
		dtheta = Math.PI/177;
		fLen = 250;
		uMax = fLen-2;	
		origin = new Point();
		blur = new BlurFilter(4,4);
		blur.quality = BitmapFilterQuality.MEDIUM;
		darken = new ColorTransform(0.3,1,0.1,1,1,1,1,0);
		var f:Number = 1;
		var d:Number = 1;
		postColor = new ColorTransform(0.1,1,1,1,d,d,d,0);	
		postBlur = new BlurFilter(2,2);
		picHolder = new Sprite();
		displayBitmapData = new BitmapData(displayWidth, displayHeight, true, 0xFFFFFFFF);
		displayBitmap = new Bitmap(displayBitmapData);
		createParticles();
		stage.addEventListener(Event.ENTER_FRAME, lightOnEnter);
	}
	private function lightOnEnter(efx:Event):void{
		baseRed = 0.9+0.1*Math.cos(getTimer()*0.00031232);
		baseGreen = 0.9+0.1*Math.cos(Math.PI/3+getTimer()*0.00039988);
		baseBlue = 0.9+0.1*Math.cos(2*Math.PI/3+getTimer()*0.00057641);
		phi = (phi + dphi) % pi2;
		theta = (theta + dtheta) % pi2;
		cost = Math.cos(theta);
		sint = Math.sin(theta);
		cosp = Math.cos(phi);
		sinp = Math.sin(phi);
		M11 = cost*sinp;
		M12 = sint*sinp;
		M31 = -cost*cosp;
		M32 = -sint*cosp;
		p = firstParticle;
		displayBitmapData.lock();
		displayBitmapData.colorTransform(displayBitmapData.rect,darken);
		displayBitmapData.applyFilter(displayBitmapData, displayBitmapData.rect, origin, blur);
		p = firstParticle;
		do {
			p.u = M11*p.x + M12*p.y + cosp*p.z;
			p.v = -sint*p.x + cost*p.y;
			p.w = M31*p.x + M32*p.y + sinp*p.z;
			m = fLen/(fLen - p.u);
			p.projX = p.v*m + projCenterX;
			p.projY = p.w*m + projCenterY;
			if ((p.projX > displayWidth)||(p.projX<0)||(p.projY<0)||(p.projY>displayHeight)||(p.u>uMax)) {
				p.onScreen = false;
			}
			else {
				p.onScreen = true;
			}
			if (p.onScreen) {
					readColor = displayBitmapData.getPixel(p.projX, p.projY);
					level = (readColor & 0xFF)/baseBlue+levelInc;
					level = (level > 255) ? 255 : level;
					dColor = (level*baseRed << 16) | (level*baseGreen << 8) | (level*baseBlue);
					displayBitmapData.setPixel(p.projX, p.projY,0xFFFFFFFF);
			}
			p = p.next;
		} while (p != null)
		displayBitmapData.applyFilter(displayBitmapData, displayBitmapData.rect, origin, postBlur);
		displayBitmapData.colorTransform(displayBitmapData.rect,postColor);
		displayBitmapData.unlock();
	}
	function createParticles():void {
		var rad1:Number;
		var rad2:Number;
		var f1:Number;
		var f2:Number;
		var s:Number;
		var t:Number;
		var sMin:Number;
		var tMin:Number;
		var sMax:Number;
		var tMax:Number;
		var sInc:Number;
		var tInc:Number;
		sMin = -Math.PI;
		sMax = Math.PI;
		tMin = -Math.PI;
		tMax = Math.PI;
		numT = 24;
		numS = 290;
		sInc = (sMax - sMin)/numS;
		tInc = (tMax - tMin)/numT;
		numParticles = numT*numS;
		var lastParticle:Particle3D;
		for (var i:int = 0; i<numT;i++) {
			t = tMin + tInc*i;
			for (var j:int = 0; j<numS;j++) {
				s = sMin + sInc*j;
				var thisParticle:Particle3D = new Particle3D(0xFFFFFF);
				rad1 = 66;
				rad2 = 33+17*Math.cos(s*3);
				thisParticle.x = rad1*Math.cos(s)+rad2*Math.cos(t)*Math.cos(s);
				thisParticle.y = rad1*Math.sin(s)+rad2*Math.cos(t)*Math.sin(s);
				thisParticle.z = rad2*Math.sin(t);
				if ((i == 0)&&(j == 0)) {
					firstParticle = thisParticle;
				}
				else {
					lastParticle.next = thisParticle;
				}
				lastParticle = thisParticle;
			}
		}
	}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		//// 3D
		protected function start():void
		{
			_modelWrapA = new DisplayObject3D();
			_modelWrapB = new DisplayObject3D();
			_modelWrapC = new DisplayObject3D();
			_modelWrapD = new DisplayObject3D();
			_particleContainer = new DisplayObject3D();
			lightBeamInit();
			lightPlane();
			this.markerNodeList[0].addChild(_modelWrapA);
			this.markerNodeList[1].addChild(_modelWrapB);
			this.markerNodeList[2].addChild(_modelWrapC);
			this.markerNodeList[3].addChild(_modelWrapD);
			this._particleContainer.addChild(createImagePlane(480, 340));
			//// MARKER ACTIONS
			this.addEventListener( MarkerEvent.MARKER_1_ADDED, this.onMarker1Added );
			this.addEventListener( MarkerEvent.MARKER_1_REMOVED, this.onMarker1Removed );
			this.addEventListener( MarkerEvent.MARKER_2_ADDED, this.onMarker2Added );
			this.addEventListener( MarkerEvent.MARKER_2_REMOVED, this.onMarker2Removed );
			this.addEventListener( MarkerEvent.MARKER_3_ADDED, this.onMarker3Added );
			this.addEventListener( MarkerEvent.MARKER_3_REMOVED, this.onMarker3Removed );
			this.addEventListener( MarkerEvent.MARKER_4_ADDED, this.onMarker4Added );
			this.addEventListener( MarkerEvent.MARKER_4_REMOVED, this.onMarker4Removed );
			//// ONENTERFRAME...
			this.addEventListener(Event.ENTER_FRAME, this.run);
		}		
		protected function lightPlane():void {
			screenMcMat = new MovieAssetMaterial("com.peteroberlaender.mc_classes.LightPlaneMat", true, true, true);
			screenMcMat.animated=true;
			screenMcMat.smooth=true;
			screenMcMat.interactive = true;
			screenMc=new Plane(screenMcMat,512,512,3,3);
			screenMc.rotationX = 180;
			screenMc.rotationZ = 90;
			screenMc.x = 0;
			screenMc.y = 0;
			screenMc.z = 0;
			onAmpsLoaded();
		}
		private function onAmpsLoaded():void
		{
			if (theV_71 == 0) {
			theV_71 = 1;
			viewport3d.containerSprite.sortMode = ViewportLayerSortMode.INDEX_SORT;
			lightBeamLayer = new ViewportLayer(viewport3d,null);
			viewport3d.containerSprite.addLayer(lightBeamLayer);
			lightBeamLayer.addDisplayObject3D(screenMc);
			screenMc.useOwnContainer = true;
			screenMc.meshSort = DisplayObject3D.MESH_SORT_FAR;
			lightBeamLayer.layerIndex = 2;
			Tweener.addTween(lightBeamLayer,{alpha:0,time:0});
			}
		}
		//// PARTICLE IMAGE PLANE
		protected function createImagePlane(w: int, h: int): DisplayObject3D {
			var bitmapMat: BitmapMaterial = new BitmapMaterial(displayBitmapData, true);
			bitmapMat.doubleSided = true;
			plane = new Plane(bitmapMat, w, h, 2,2);
			plane.rotationZ = 90;
			plane.rotationX = 180;
			particleLayer1 = new ViewportLayer(viewport3d,null);
			viewport3d.containerSprite.addLayer(particleLayer1);
			particleLayer1.addDisplayObject3D(plane);
			particleLayer1.filters = [
							new ColorMatrixFilter([
							1, 0, 0, 0, 0,
							0, 1, 0, 0, 0,
							0, 0, 1, 0, 0,
							1, -1, 1, 1, 0
								])
							];
			particleLayer1.layerIndex = 1;
			Tweener.addTween(particleLayer1,{alpha:0,time:0});
			return plane;
		}
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
//////////// MARKER ACTIONS
	//////// MARKER 1
		public function onMarker1Added(e : Event= null) : void {
			for (theV_1;theV_1 < 1; theV_1++){
			this.markerNodeList[0].visible = true;
			if (_ampsBAdded == true && _ampsBRemoved == false) { _modelWrapB.removeChild(screenMc); _modelWrapB.removeChild(_particleContainer); _ampsBAdded = false; _ampsBRemoved = true; }
			if (_ampsCAdded == true && _ampsCRemoved == false) { _modelWrapC.removeChild(screenMc); _modelWrapC.removeChild(_particleContainer); _ampsCAdded = false; _ampsCRemoved = true; }
			if (_ampsDAdded == true && _ampsDRemoved == false) { _modelWrapD.removeChild(screenMc); _modelWrapD.removeChild(_particleContainer); _ampsDAdded = false; _ampsDRemoved = true; }
			if (_ampsAAdded == true && _ampsARemoved == false) { trace("A nothing"); } 
			else {
				_modelWrapA.addChild(screenMc);
				_modelWrapA.addChild(_particleContainer);
				_ampsAAdded = true;
				_ampsARemoved = false;
			}			
			point_b_mc.visible = false;
			point_c_mc.visible = false;
			point_d_mc.visible = false;
			point_a_mc.visible = true;
			Tweener.addTween(point_a_mc, {alpha:1, time:1.5, transition:"easeOutStrong"});
			Tweener.addTween(point_a_mc, {time:2.4, onComplete:function(){shootA = true;}});
			Tweener.addTween(lightBeamLayer,{alpha:1,time:1.5, transition:"easeOutStrong"});
			Tweener.addTween(particleLayer1,{alpha:1,time:1.5, transition:"easeOutStrong"});
			trace("[ 1 added ]");
			}
		}
		public function onMarker1Updated(e : Event= null) : void {
		}
		public function onMarker1Removed(e : Event= null) : void {
			if (theV_1 == 1) {
				shootA = false;
				Tweener.addTween(point_a_mc, {time:2.5, onComplete:function(){shootA = false;}});
				loadSignA.visible = false;
			this.markerNodeList[0].visible = true;
			Tweener.addTween(point_a_mc, {alpha:0, time:1.5, transition:"easeOutStrong", onComplete:function(){
																											  point_a_mc.visible = false;
																											  markerNodeList[0].visible = false;
																											  }});
			Tweener.addTween(lightBeamLayer,{alpha:0,time:1.5, transition:"easeOutStrong"});
			Tweener.addTween(particleLayer1,{alpha:0,time:1.5, transition:"easeOutStrong"});
			trace("[ 1 removed ]");
			theV_1 = 0;
			}
		}
	//////// MARKER 2
		public function onMarker2Added(e : Event= null) : void {
			for (theV_2;theV_2 < 1; theV_2++){
			this.markerNodeList[1].visible = true;
			if (_ampsAAdded == true && _ampsARemoved == false) { _modelWrapA.removeChild(screenMc); _modelWrapA.removeChild(_particleContainer); _ampsAAdded = false; _ampsARemoved = true; }
			if (_ampsCAdded == true && _ampsCRemoved == false) { _modelWrapC.removeChild(screenMc); _modelWrapC.removeChild(_particleContainer); _ampsCAdded = false; _ampsCRemoved = true; }
			if (_ampsDAdded == true && _ampsDRemoved == false) { _modelWrapD.removeChild(screenMc); _modelWrapD.removeChild(_particleContainer); _ampsDAdded = false; _ampsDRemoved = true; }
			if (_ampsBAdded == true && _ampsBRemoved == false) { trace("B nothing"); } 
			else {
				_modelWrapB.addChild(screenMc);
				_modelWrapB.addChild(_particleContainer);
				_ampsBAdded = true;
				_ampsBRemoved = false;
			}			
			point_a_mc.visible = false;
			point_c_mc.visible = false;
			point_d_mc.visible = false;
			point_b_mc.visible = true;
			Tweener.addTween(point_b_mc, {alpha:1, time:1.5, transition:"easeOutStrong"});
			Tweener.addTween(point_b_mc, {time:2.4, onComplete:function(){shootB = true;}});
			Tweener.addTween(lightBeamLayer,{alpha:1,time:1.5, transition:"easeOutStrong"});
			Tweener.addTween(particleLayer1,{alpha:1,time:1.5, transition:"easeOutStrong"});
			trace("[ 2 added ]");
			}
		}
		public function onMarker2Removed(e : Event= null) : void {
			if (theV_2 == 1) {
				shootB = false;
				Tweener.addTween(point_b_mc, {time:2.5, onComplete:function(){shootB = false;}});
				loadSignB.visible = false;
			this.markerNodeList[1].visible = true;
			Tweener.addTween(point_b_mc, {alpha:0, time:1.5, transition:"easeOutStrong", onComplete:function(){
																											  point_b_mc.visible = false;
																											  markerNodeList[1].visible = false;
																											  }});
			Tweener.addTween(lightBeamLayer,{alpha:0,time:1.5, transition:"easeOutStrong"});
			Tweener.addTween(particleLayer1,{alpha:0,time:1.5, transition:"easeOutStrong"});
			trace("[ 2 removed ]");
			theV_2 = 0;
			}
		}
	//////// MARKER 3
		public function onMarker3Added(e : Event= null) : void {
			for (theV_3;theV_3 < 1; theV_3++){
			this.markerNodeList[2].visible = true;
			if (_ampsBAdded == true && _ampsBRemoved == false) { _modelWrapB.removeChild(screenMc); _modelWrapB.removeChild(_particleContainer); _ampsBAdded = false; _ampsBRemoved = true; }
			if (_ampsAAdded == true && _ampsARemoved == false) { _modelWrapA.removeChild(screenMc); _modelWrapA.removeChild(_particleContainer); _ampsAAdded = false; _ampsARemoved = true; }
			if (_ampsDAdded == true && _ampsDRemoved == false) { _modelWrapD.removeChild(screenMc); _modelWrapD.removeChild(_particleContainer); _ampsDAdded = false; _ampsDRemoved = true; }
			if (_ampsCAdded == true && _ampsCRemoved == false) { trace("C nothing"); } 
			else {
				_modelWrapC.addChild(screenMc);
				_modelWrapC.addChild(_particleContainer);
				_ampsCAdded = true;
				_ampsCRemoved = false;
			}
			point_a_mc.visible = false;
			point_b_mc.visible = false;
			point_d_mc.visible = false;
			point_c_mc.visible = true;
			Tweener.addTween(point_c_mc, {alpha:1, time:1.5, transition:"easeOutStrong"});
			Tweener.addTween(point_c_mc, {time:2.4, onComplete:function(){shootC = true;}});
			Tweener.addTween(lightBeamLayer,{alpha:1,time:1.5, transition:"easeOutStrong"});
			Tweener.addTween(particleLayer1,{alpha:1,time:1.5, transition:"easeOutStrong"});
			trace("[ 3 added ]");
			}
		}
		public function onMarker3Removed(e : Event= null) : void {
			if (theV_3 == 1) {
				shootC = false;
				Tweener.addTween(point_c_mc, {time:2.5, onComplete:function(){shootC = false;}});
				loadSignC.visible = false;
			this.markerNodeList[2].visible = true;
			Tweener.addTween(point_c_mc, {alpha:0, time:1.5, transition:"easeOutStrong", onComplete:function(){
																											  point_c_mc.visible = false;
																											  markerNodeList[2].visible = false;
																											  }});
			Tweener.addTween(lightBeamLayer,{alpha:0,time:1.5, transition:"easeOutStrong"});
			Tweener.addTween(particleLayer1,{alpha:0,time:1.5, transition:"easeOutStrong"});
			trace("[ 3 removed ]");
			theV_3 = 0;
			}
		}
	//////// MARKER 4
		public function onMarker4Added(e : Event= null) : void {
			for (theV_4;theV_4 < 1; theV_4++){
			this.markerNodeList[3].visible = true;
			if (_ampsBAdded == true && _ampsBRemoved == false) { _modelWrapB.removeChild(screenMc); _modelWrapB.removeChild(_particleContainer); _ampsBAdded = false; _ampsBRemoved = true; }
			if (_ampsCAdded == true && _ampsCRemoved == false) { _modelWrapC.removeChild(screenMc); _modelWrapC.removeChild(_particleContainer); _ampsCAdded = false; _ampsCRemoved = true; }
			if (_ampsAAdded == true && _ampsARemoved == false) { _modelWrapA.removeChild(screenMc); _modelWrapA.removeChild(_particleContainer); _ampsAAdded = false; _ampsARemoved = true; }
			if (_ampsDAdded == true && _ampsDRemoved == false) { trace("D nothing"); } 
			else {
				_modelWrapD.addChild(screenMc);
				_modelWrapD.addChild(_particleContainer);
				_ampsDAdded = true;
				_ampsDRemoved = false;
			}
			point_a_mc.visible = false;
			point_b_mc.visible = false;
			point_c_mc.visible = false;
			point_d_mc.visible = true;
			Tweener.addTween(point_d_mc, {alpha:1, time:1.5, transition:"easeOutStrong"});
			Tweener.addTween(point_d_mc, {time:2.4, onComplete:function(){shootD = true;}});
			Tweener.addTween(lightBeamLayer,{alpha:1,time:1.5, transition:"easeOutStrong"});
			Tweener.addTween(particleLayer1,{alpha:1,time:1.5, transition:"easeOutStrong"});
			trace("[ 4 added ]");
			}
		}
		public function onMarker4Removed(e : Event= null) : void {
			if (theV_4 == 1) {
				shootD = false;
				Tweener.addTween(point_d_mc, {time:2.5, onComplete:function(){shootD = false;}});
				loadSignD.visible = false;
			this.markerNodeList[3].visible = true;
			Tweener.addTween(point_d_mc, {alpha:0, time:1.5, transition:"easeOutStrong", onComplete:function(){
																											  point_d_mc.visible = false;
																											  markerNodeList[3].visible = false;
																											  }});
			Tweener.addTween(lightBeamLayer,{alpha:0,time:1.5, transition:"easeOutStrong"});
			Tweener.addTween(particleLayer1,{alpha:0,time:1.5, transition:"easeOutStrong"});
			trace("[ 4 removed ]");
			theV_4 = 0;
			}
		}
///////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
		//// ADELAY 		
		public function ADelay():void {
			trace("REMOVE BCD");
			if(fieldBActive==true && fieldBOn==true){
						myClip2.removeEventListener(Event.ENTER_FRAME, _controlAC);
						myClip2.removeEventListener(Event.ENTER_FRAME, ACFunctionality);				
						if (field_b.contains(myClip2)) 
						{
							field_b.removeChild(myClip2);
						}
						externalSwfLoader.unloadAndStop();
						theV_55=0;
						var mov2:MovieClip = trig_b_img as trig_B_img;
						mov2.ac_trStop();
					stage.removeChild(field_b);
					fieldBActive = false;
					fieldBOn = false;
					stageInUse = false;
					theV_6 = 0;
					Tweener.addTween(point_b_img, {scaleX:1, scaleY:1, time:0});
					Tweener.addTween(point_b_mc, {time:1, onComplete:function(){theV_10 = 0;}});
					}
			if(fieldCActive==true && fieldCOn==true){
						if (vidAActive == true || vidBActive == true) {
							myClip.removeEventListener(Event.ENTER_FRAME, _controlVid);
							myClip.removeEventListener(Event.ENTER_FRAME, VidFunctionality);							
							if (field_c.contains(myClip)) 
							{
								field_c.removeChild(myClip);
							}
							externalSwfLoader.unloadAndStop();
							theV_30=0;
							vidAActive = false;
							vidBActive = false;
						}
							if (vidBtns_On == true) { vidBtn_Box.removeEventListener(Event.ENTER_FRAME, _vidBtn_Exe); }
							Tweener.addTween(vidBtn_A.vidGallBtn_1, {alpha:0, time:0});
							Tweener.addTween(vidBtn_B.vidGallBtn_2, {alpha:0, time:0});
						var mov3:MovieClip = trig_c_img as trig_C_img;
						mov3.v_blStop();
					stage.removeChild(field_c);
					fieldCActive = false;
					fieldCOn = false;
					stageInUse = false;
					theV_7 = 0;
					Tweener.addTween(point_c_img, {scaleX:1, scaleY:1, time:0});
					Tweener.addTween(point_c_mc, {time:1, onComplete:function(){theV_11 = 0;}});
					}
			if(fieldDActive==true && fieldDOn==true){
						myClip4.removeEventListener(Event.ENTER_FRAME, _controlGall);
						myClip4.removeEventListener(Event.ENTER_FRAME, GallFunctionality);
						if (field_d.contains(myClip4)) 
						{
							field_d.removeChild(myClip4);
						}
						externalSwfLoader.unloadAndStop();
						theV_50=0;
						var mov4:MovieClip = trig_d_img as trig_D_img;
						mov4.g_brStop();
					stage.removeChild(field_d);
					fieldDActive = false;
					fieldDOn = false;
					stageInUse = false;
					theV_8 = 0;
					Tweener.addTween(point_d_img, {scaleX:1, scaleY:1, time:0});
					Tweener.addTween(point_d_mc, {time:1, onComplete:function(){theV_12 = 0;}});
					}
			fieldAActive = true;
			fieldBActive = false;
			fieldCActive = false;
			fieldDActive = false;
			stageInUse = true;
			theV_5 = theV_5+1;
			var mov1:MovieClip = trig_a_img as trig_A_img;
			mov1.sl_tlGo();
			if(fieldAActive==true && theV_5==1){
				stage.addChildAt(field_a, 2);
				Tweener.addTween(field_a, {alpha:0, time:0});
				Tweener.addTween(field_a, {x:stage.stageWidth/2, y:stage.stageHeight/2, alpha:1, time:3.0, transition:"easeOutStrong"});
				fieldAOn = true;
				swfFileLocation = "songs_n_lyrics.swf";
				loadExternalSwf();
				Tweener.addTween(point_a_img, {scaleX:0.5, scaleY:0.5, time:0});
				theV_72 = 0;
			}
		}
		//// BDELAY
		public function BDelay():void {
			trace("REMOVE ACD");
			if(fieldAActive==true && fieldAOn==true){
						myClip1.removeEventListener(Event.ENTER_FRAME, _controlSL);
						myClip1.removeEventListener(Event.ENTER_FRAME, SLFunctionality);
						if (field_a.contains(myClip1)) 
						{
							field_a.removeChild(myClip1);
						}
						externalSwfLoader.unloadAndStop();
						theV_40=0;
						var mov1:MovieClip = trig_a_img as trig_A_img;						
						mov1.sl_tlStop();
					stage.removeChild(field_a);
					fieldAActive = false;
					fieldAOn = false;
					stageInUse = false;
					theV_5 = 0;
					Tweener.addTween(point_a_img, {scaleX:1, scaleY:1, time:0});
					Tweener.addTween(point_a_mc, {time:1, onComplete:function(){theV_9 = 0;}});
					}
			if(fieldCActive==true && fieldCOn==true){
						if (vidAActive == true || vidBActive == true) {
							myClip.removeEventListener(Event.ENTER_FRAME, _controlVid);
							myClip.removeEventListener(Event.ENTER_FRAME, VidFunctionality);
							if (field_c.contains(myClip)) 
							{
								field_c.removeChild(myClip);
							}
							externalSwfLoader.unloadAndStop();
							theV_30=0;
							vidAActive = false;
							vidBActive = false;
						}
							if (vidBtns_On == true) { vidBtn_Box.removeEventListener(Event.ENTER_FRAME, _vidBtn_Exe); }
							Tweener.addTween(vidBtn_A.vidGallBtn_1, {alpha:0, time:0});
							Tweener.addTween(vidBtn_B.vidGallBtn_2, {alpha:0, time:0});
						var mov3:MovieClip = trig_c_img as trig_C_img;
						mov3.v_blStop();
					stage.removeChild(field_c);
					fieldCActive = false;
					fieldCOn = false;
					stageInUse = false;
					theV_7 = 0;
					Tweener.addTween(point_c_img, {scaleX:1, scaleY:1, time:0});
					Tweener.addTween(point_c_mc, {time:1, onComplete:function(){theV_11 = 0;}});
					}
			if(fieldDActive==true && fieldDOn==true){
						myClip4.removeEventListener(Event.ENTER_FRAME, _controlGall);
						myClip4.removeEventListener(Event.ENTER_FRAME, GallFunctionality);
						if (field_d.contains(myClip4)) 
						{
							field_d.removeChild(myClip4);
						}
						externalSwfLoader.unloadAndStop();
						theV_50=0;
						var mov4:MovieClip = trig_d_img as trig_D_img;
						mov4.g_brStop();
					stage.removeChild(field_d);
					fieldDActive = false;
					fieldDOn = false;
					stageInUse = false;
					theV_8 = 0;
					Tweener.addTween(point_d_img, {scaleX:1, scaleY:1, time:0});
					Tweener.addTween(point_d_mc, {time:1, onComplete:function(){theV_12 = 0;}});
					}
			fieldBActive = true;
			fieldAActive = false;
			fieldCActive = false;
			fieldDActive = false;
			stageInUse = true;
			theV_6 = theV_6+1;
			var mov2:MovieClip = trig_b_img as trig_B_img;
			mov2.ac_trGo();
			if(fieldBActive==true && theV_6==1){
				stage.addChildAt(field_b, 2);
				Tweener.addTween(field_b, {alpha:0, time:0});
				Tweener.addTween(field_b, {x:stage.stageWidth/2, y:stage.stageHeight/2, alpha:1, time:3.0, transition:"easeOutStrong"});
				fieldBOn = true;
				swfFileLocation = "angelcome.swf";
				loadExternalSwf();
				Tweener.addTween(point_b_img, {scaleX:0.5, scaleY:0.5, time:0});
				theV_72 = 0;
			}
		}
		//// CDELAY
		public function CDelay():void {
			trace("REMOVE ABD");
			if(fieldAActive==true && fieldAOn==true){
						myClip1.removeEventListener(Event.ENTER_FRAME, _controlSL);
						myClip1.removeEventListener(Event.ENTER_FRAME, SLFunctionality);
						if (field_a.contains(myClip1)) 
						{
							field_a.removeChild(myClip1);
						}
						externalSwfLoader.unloadAndStop();
						theV_40=0;
						var mov1:MovieClip = trig_a_img as trig_A_img;						
						mov1.sl_tlStop();
					stage.removeChild(field_a);
					fieldAActive = false;
					fieldAOn = false;
					stageInUse = false;
					theV_5 = 0;
					Tweener.addTween(point_a_img, {scaleX:1, scaleY:1, time:0});
					Tweener.addTween(point_a_mc, {time:1, onComplete:function(){theV_9 = 0;}});
					}
			if(fieldBActive==true && fieldBOn==true){
						myClip2.removeEventListener(Event.ENTER_FRAME, _controlAC);
						myClip2.removeEventListener(Event.ENTER_FRAME, ACFunctionality);
						if (field_b.contains(myClip2)) 
						{
							field_b.removeChild(myClip2);
						}
						externalSwfLoader.unloadAndStop();
						theV_55=0;
						var mov2:MovieClip = trig_b_img as trig_B_img;
						mov2.ac_trStop();
					stage.removeChild(field_b);
					fieldBActive = false;
					fieldBOn = false;
					stageInUse = false;
					theV_6 = 0;
					Tweener.addTween(point_b_img, {scaleX:1, scaleY:1, time:0});
					Tweener.addTween(point_b_mc, {time:1, onComplete:function(){theV_10 = 0;}});
					}
			if(fieldDActive==true && fieldDOn==true){
						myClip4.removeEventListener(Event.ENTER_FRAME, _controlGall);
						myClip4.removeEventListener(Event.ENTER_FRAME, GallFunctionality);
						if (field_d.contains(myClip4)) 
						{
							field_d.removeChild(myClip4);
						}
						externalSwfLoader.unloadAndStop();
						theV_50=0;
						var mov4:MovieClip = trig_d_img as trig_D_img;
						mov4.g_brStop();
					stage.removeChild(field_d);
					fieldDActive = false;
					fieldDOn = false;
					stageInUse = false;
					theV_8 = 0;
					Tweener.addTween(point_d_img, {scaleX:1, scaleY:1, time:0});
					Tweener.addTween(point_d_mc, {time:1, onComplete:function(){theV_12 = 0;}});
					}
			fieldCActive = true;
			fieldAActive = false;
			fieldBActive = false;
			fieldDActive = false;
			stageInUse = true;
			theV_7 = theV_7+1;
			var mov3:MovieClip = trig_c_img as trig_C_img;
			mov3.v_blGo();
			if(fieldCActive==true && theV_7==1){
				stage.addChildAt(field_c, 2);
				Tweener.addTween(field_c, {alpha:0, time:0});
				Tweener.addTween(field_c, {x:stage.stageWidth/2, y:stage.stageHeight/2, alpha:1, time:3.0, transition:"easeOutStrong"});
				fieldCOn = true;
				myClipReady = true;
					Tweener.addTween(vidBtn_A.vidGallBtn_1, {alpha:0.5, time:2, transition:"easeOutStrong"});
					Tweener.addTween(vidBtn_A.vidGallFrame_1, {alpha:1, time:0});
					Tweener.addTween(vidBtn_B.vidGallBtn_2, {alpha:0.5, time:2, transition:"easeOutStrong"});
					Tweener.addTween(vidBtn_B.vidGallFrame_2, {alpha:1, time:0});
					theV_31=0;
					theV_32=0;
					vidBtn_Box.addEventListener(Event.ENTER_FRAME, _vidBtn_Exe);
					vidBtns_On = true;
				Tweener.addTween(point_c_img, {scaleX:0.5, scaleY:0.5, time:0});
				theV_72 = 0;
			}
		}
		//// DDELAY
		public function DDelay():void {
			trace("REMOVE ABC");
			if(fieldAActive==true && fieldAOn==true){
						myClip1.removeEventListener(Event.ENTER_FRAME, _controlSL);
						myClip1.removeEventListener(Event.ENTER_FRAME, SLFunctionality);
						if (field_a.contains(myClip1)) 
						{
							field_a.removeChild(myClip1);
						}
						externalSwfLoader.unloadAndStop();
						theV_40=0;
						var mov1:MovieClip = trig_a_img as trig_A_img;						
						mov1.sl_tlStop();
					stage.removeChild(field_a);
					fieldAActive = false;
					fieldAOn = false;
					stageInUse = false;
					theV_5 = 0;
					Tweener.addTween(point_a_img, {scaleX:1, scaleY:1, time:0});
					Tweener.addTween(point_a_mc, {time:1, onComplete:function(){theV_9 = 0;}});
					}
			if(fieldBActive==true && fieldBOn==true){
						myClip2.removeEventListener(Event.ENTER_FRAME, _controlAC);
						myClip2.removeEventListener(Event.ENTER_FRAME, ACFunctionality);
						if (field_b.contains(myClip2)) 
						{
							field_b.removeChild(myClip2);
						}
						externalSwfLoader.unloadAndStop();
						theV_55=0;
						var mov2:MovieClip = trig_b_img as trig_B_img;
						mov2.ac_trStop();
					stage.removeChild(field_b);
					fieldBActive = false;
					fieldBOn = false;
					theV_6 = 0;
					stageInUse = false;
					Tweener.addTween(point_b_img, {scaleX:1, scaleY:1, time:0});
					Tweener.addTween(point_b_mc, {time:1, onComplete:function(){theV_10 = 0;}});
					}
			if(fieldCActive==true && fieldCOn==true){
						if (vidAActive == true || vidBActive == true) {
							myClip.removeEventListener(Event.ENTER_FRAME, _controlVid);
							myClip.removeEventListener(Event.ENTER_FRAME, VidFunctionality);							
							if (field_c.contains(myClip)) 
							{
								field_c.removeChild(myClip);
							}
							externalSwfLoader.unloadAndStop();
							theV_30=0;
							vidAActive = false;
							vidBActive = false;
						}
							if (vidBtns_On == true) { vidBtn_Box.removeEventListener(Event.ENTER_FRAME, _vidBtn_Exe); }
							Tweener.addTween(vidBtn_A.vidGallBtn_1, {alpha:0, time:0});
							Tweener.addTween(vidBtn_B.vidGallBtn_2, {alpha:0, time:0});
						var mov3:MovieClip = trig_c_img as trig_C_img;
						mov3.v_blStop();
					stage.removeChild(field_c);
					fieldCActive = false;
					fieldCOn = false;
					theV_7 = 0;
					stageInUse = false;
					Tweener.addTween(point_c_img, {scaleX:1, scaleY:1, time:0});
					Tweener.addTween(point_c_mc, {time:1, onComplete:function(){theV_11 = 0;}});
					}
			fieldDActive = true;
			fieldAActive = false;
			fieldBActive = false;
			fieldCActive = false;
			stageInUse = true;
			theV_8 = theV_8+1;
			var mov4:MovieClip = trig_d_img as trig_D_img;
			mov4.g_brGo();
			if(fieldDActive==true && theV_8==1){
				stage.addChildAt(field_d, 2);
				Tweener.addTween(field_d, {alpha:0, time:0});
				Tweener.addTween(field_d, {x:stage.stageWidth/2, y:stage.stageHeight/2, alpha:1, time:3.0, transition:"easeOutStrong"});
				fieldDOn = true;
				swfFileLocation = "gallery.swf";
				loadExternalSwf();
				Tweener.addTween(point_d_img, {scaleX:0.5, scaleY:0.5, time:0});
				theV_72 = 0;
			}
		}
		//// HOMEDELAY
		public function homeDelay():void {
			if(fieldAActive==true && fieldAOn==true){
						myClip1.removeEventListener(Event.ENTER_FRAME, _controlSL);
						myClip1.removeEventListener(Event.ENTER_FRAME, SLFunctionality);
						if (field_a.contains(myClip1)) 
						{
							field_a.removeChild(myClip1);
						}
						externalSwfLoader.unloadAndStop();
						theV_40=0;
						var mov1:MovieClip = trig_a_img as trig_A_img;						
						mov1.sl_tlStop();
					stage.removeChild(field_a);
					fieldAActive = false;
					fieldAOn = false;
					stageInUse = false;
					theV_5 = 0;
					Tweener.addTween(point_a_img, {scaleX:1, scaleY:1, time:0});
					Tweener.addTween(point_a_mc, {time:1, onComplete:function(){theV_9 = 0;}});
					}
			if(fieldBActive==true && fieldBOn==true){
						myClip2.removeEventListener(Event.ENTER_FRAME, _controlAC);
						myClip2.removeEventListener(Event.ENTER_FRAME, ACFunctionality);
						if (field_b.contains(myClip2)) 
						{
							field_b.removeChild(myClip2);
						}
						externalSwfLoader.unloadAndStop();
						theV_55=0;
						var mov2:MovieClip = trig_b_img as trig_B_img;
						mov2.ac_trStop();
					stage.removeChild(field_b);
					fieldBActive = false;
					fieldBOn = false;
					stageInUse = false;
					theV_6 = 0;
					Tweener.addTween(point_b_img, {scaleX:1, scaleY:1, time:0});
					Tweener.addTween(point_b_mc, {time:1, onComplete:function(){theV_10 = 0;}});
					}
			if(fieldCActive==true && fieldCOn==true){
						if (vidAActive == true || vidBActive == true) {
							myClip.removeEventListener(Event.ENTER_FRAME, _controlVid);
							myClip.removeEventListener(Event.ENTER_FRAME, VidFunctionality);
							if (field_c.contains(myClip)) 
							{
								field_c.removeChild(myClip);
							}
							externalSwfLoader.unloadAndStop();
							theV_30=0;
							vidAActive = false;
							vidBActive = false;
						}
							if (vidBtns_On == true) { vidBtn_Box.removeEventListener(Event.ENTER_FRAME, _vidBtn_Exe); }
							Tweener.addTween(vidBtn_A.vidGallBtn_1, {alpha:0, time:0});
							Tweener.addTween(vidBtn_B.vidGallBtn_2, {alpha:0, time:0});
						var mov3:MovieClip = trig_c_img as trig_C_img;
						mov3.v_blStop();
					stage.removeChild(field_c);
					fieldCActive = false;
					fieldCOn = false;
					stageInUse = false;
					theV_7 = 0;
					Tweener.addTween(point_c_img, {scaleX:1, scaleY:1, time:0});
					Tweener.addTween(point_c_mc, {time:1, onComplete:function(){theV_11 = 0;}});
					}
			if(fieldDActive==true && fieldDOn==true){
						myClip4.removeEventListener(Event.ENTER_FRAME, _controlGall);
						myClip4.removeEventListener(Event.ENTER_FRAME, GallFunctionality);
						if (field_d.contains(myClip4)) 
						{
							field_d.removeChild(myClip4);
						}
						externalSwfLoader.unloadAndStop();
						theV_50=0;
						var mov4:MovieClip = trig_d_img as trig_D_img;
						mov4.g_brStop();
					stage.removeChild(field_d);
					fieldDActive = false;
					fieldDOn = false;
					stageInUse = false;
					theV_8 = 0;
					Tweener.addTween(point_d_img, {scaleX:1, scaleY:1, time:0});
					Tweener.addTween(point_d_mc, {time:1, onComplete:function(){theV_12 = 0;}});
					}
			Tweener.addTween(homeBtn.HomeBtnContent, {x:-68, time:1.5, transition:"easeOutStrong"});
			Tweener.addTween(homeBtn.HomeBtnContent, {delay:1.7,time:0,_Glow_alpha:0,_Glow_blurX:0,_Glow_blurY:0,_Glow_color:0xffffff,_Glow_strength:0});
			Tweener.addTween(homeBtn.HomeBtnContent, {time:1, onComplete:function(){theV_72 = 0;}});
		}
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
		//// MENU
		private function createSourceLink():void {
			_menuDLSource = new ContextMenu();
			var menuDL:ContextMenuItem = new ContextMenuItem("Created by Saint Aside");
			menuDL.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, downloadSource);
			_menuDLSource.customItems.push(menuDL);
			this.contextMenu = _menuDLSource;
		}
		private function downloadSource(event:ContextMenuEvent):void {
			var reqUrl:URLRequest = new URLRequest("http://www.saintaside.com");
			navigateToURL(reqUrl);
		}
		//// RUN AR
		public function run(e:Event):void
		{
			this.capture.bitmapData.draw(this.video);
			//// MARKER DETECT
			var detectedNumber:int = 0;
			try {
				//// SINGLE MARKER DETECTOR
				detectedNumber = this.detector.detectMarkerLite(this.raster, this._threshold);
			} catch (e:Error) {}
			var i:int=0;
			for (i=0; i<this.markerPatternList.length; i++) {
				this.markerList[i].isPrevDetect = this.markerList[i].isDetect;
				this.markerList[i].isDetect = false;
				this.markerList[i].confidence = 0.0;
			}
			for (i=0; i<detectedNumber; i++) {
				if (this.detector.getConfidence(i) > 0.7) {
					var detectMarkerID:int = this.detector.getARCodeIndex(i);
					var congidence:Number = this.detector.getConfidence(i);
					if (this.markerList[detectMarkerID].confidence < congidence) {
						this.markerList[detectMarkerID].confidence = congidence;
						this.detector.getTransformMatrix(i, this.markerList[detectMarkerID].resultMat);
						this.markerList[detectMarkerID].isDetect = true;
					}
				}
			}
			for (i=0; i<this.markerPatternList.length; i++) {
				//// MARKER NR.1
				if (markerList[0].isDetect && markerList[0].isPrevDetect) {
					this.markerNodeList[0].setTransformMatrix(markerList[0].resultMat);
				} else if (markerList[0].isDetect) {
					this.markerNodeList[0].setTransformMatrix(markerList[0].resultMat);
					this.dispatchEvent( new MarkerEvent( MarkerEvent.MARKER_1_ADDED ) );
				} else {
					this.dispatchEvent( new MarkerEvent( MarkerEvent.MARKER_1_REMOVED ) );
				}
				//// MARKER NR.2
				if (markerList[1].isDetect && markerList[1].isPrevDetect) {
					this.markerNodeList[1].setTransformMatrix(markerList[1].resultMat);
				} else if (markerList[1].isDetect) {
					this.markerNodeList[1].setTransformMatrix(markerList[1].resultMat);
					this.dispatchEvent( new MarkerEvent( MarkerEvent.MARKER_2_ADDED ) );
				} else {
					this.dispatchEvent( new MarkerEvent( MarkerEvent.MARKER_2_REMOVED ) );				
				}
				//// MARKER NR.3				
				if (markerList[2].isDetect && markerList[2].isPrevDetect) {
					this.markerNodeList[2].setTransformMatrix(markerList[2].resultMat);
				} else if (markerList[2].isDetect) {
					this.markerNodeList[2].setTransformMatrix(markerList[2].resultMat);
					this.dispatchEvent( new MarkerEvent( MarkerEvent.MARKER_3_ADDED ) );
				} else {
					this.dispatchEvent( new MarkerEvent( MarkerEvent.MARKER_3_REMOVED ) );
				}
				//// MARKER NR.4
				if (markerList[3].isDetect && markerList[3].isPrevDetect) {
					this.markerNodeList[3].setTransformMatrix(markerList[3].resultMat);
				} else if (markerList[3].isDetect) {
					this.markerNodeList[3].setTransformMatrix(markerList[3].resultMat);
					this.dispatchEvent( new MarkerEvent( MarkerEvent.MARKER_4_ADDED ) );
				} else {
					this.dispatchEvent( new MarkerEvent( MarkerEvent.MARKER_4_REMOVED ) );				
				}
			}
			//// DUALPTAIL
			if (this.markerPatternList.length==0) {
				var th:int=this._threshold_detect.analyzeRaster(this.raster);
				this._threshold=(this._threshold+th)/2;
			}
			updateTargets();
			updateTriggers();
			this.renderer.render();
		}
		//// TRIGGERS UPDATE
		private function updateTriggers():void{
			var captureTranslationX1:Number = -(((this.markerNodeList[0].x/640)*(this.stage.stageWidth)/(this.markerNodeList[0].z/1000)) ) + (this.stage.stageWidth/2);
			var captureTranslationY1:Number = -(((this.markerNodeList[0].y/480)*(this.stage.stageHeight)/(this.markerNodeList[0].z/1000)) ) + (this.stage.stageHeight/2);
			var captureTranslationX2:Number = -(((this.markerNodeList[1].x/640)*(this.stage.stageWidth)/(this.markerNodeList[1].z/1000)) ) + (this.stage.stageWidth/2);
			var captureTranslationY2:Number = -(((this.markerNodeList[1].y/480)*(this.stage.stageHeight)/(this.markerNodeList[1].z/1000)) ) + (this.stage.stageHeight/2);
			var captureTranslationX3:Number = -(((this.markerNodeList[2].x/640)*(this.stage.stageWidth)/(this.markerNodeList[2].z/1000)) ) + (this.stage.stageWidth/2);
			var captureTranslationY3:Number = -(((this.markerNodeList[2].y/480)*(this.stage.stageHeight)/(this.markerNodeList[2].z/1000)) ) + (this.stage.stageHeight/2);
			var captureTranslationX4:Number = -(((this.markerNodeList[3].x/640)*(this.stage.stageWidth)/(this.markerNodeList[3].z/1000)) ) + (this.stage.stageWidth/2);
			var captureTranslationY4:Number = -(((this.markerNodeList[3].y/480)*(this.stage.stageHeight)/(this.markerNodeList[3].z/1000)) ) + (this.stage.stageHeight/2);
			point_a_mc.x = captureTranslationX1;
			point_a_mc.y = captureTranslationY1;
			point_b_mc.x = captureTranslationX2;
			point_b_mc.y = captureTranslationY2;
			point_c_mc.x = captureTranslationX3;
			point_c_mc.y = captureTranslationY3;			
			point_d_mc.x = captureTranslationX4;
			point_d_mc.y = captureTranslationY4;			
		}
		private function updateTargets():void{
			trgt_1 = trig_a_mc.getChildAt(0) as MovieClip;
			trgt_2 = trig_b_mc.getChildAt(0) as MovieClip;
			trgt_3 = trig_c_mc.getChildAt(0) as MovieClip;
			trgt_4 = trig_d_mc.getChildAt(0) as MovieClip;
			if(trgt_1.hitTestObject(point_a) && point_a_mc.visible==true && fieldAOn == false && shootA == true){
				for (theV_9;theV_9 < 1; theV_9++){
					trace("[ HIT A ]");
					ADelay();
					my_Song.play();
					Tweener.addTween(homeBtn.HomeBtnContent, {x:-18,delay:0, time:1.5, transition:"easeOutStrong"});
				}
			}
			if(trgt_2.hitTestObject(point_b) && point_b_mc.visible==true && fieldBOn == false && shootB == true){
				for (theV_10;theV_10 < 1; theV_10++){
					trace("[ HIT B ]");
					BDelay();
					my_Song.play();
					Tweener.addTween(homeBtn.HomeBtnContent, {x:-18,delay:0, time:1.5, transition:"easeOutStrong"});
				}
			}
			if(trgt_3.hitTestObject(point_c) && point_c_mc.visible==true && fieldCOn == false && shootC == true){
				for (theV_11;theV_11 < 1; theV_11++){
					trace("[ HIT C ]");
					CDelay();
					my_Song.play();
					Tweener.addTween(homeBtn.HomeBtnContent, {x:-18,delay:0, time:1.5, transition:"easeOutStrong"});
				}
			}
			if(trgt_4.hitTestObject(point_d) && point_d_mc.visible==true && fieldDOn == false && shootD == true){
				for (theV_12;theV_12 < 1; theV_12++){
					trace("[ HIT D ]");
					DDelay();
					my_Song.play();
					Tweener.addTween(homeBtn.HomeBtnContent, {x:-18,delay:0, time:1.5, transition:"easeOutStrong"});
				}
			}
			//// HOME BTN ONE 4 ALL			
			if(stageInUse == true) {
				if((homeBtnTrigA.hitTestObject(point_a) && point_a_mc.visible == true && ((fieldAOn == true) || (fieldBOn == true) || (fieldCOn == true) || (fieldDOn == true)) && myClipReady == true && (shootA == true || shootB == true || shootC == true || shootD == true)) 
				|| (homeBtnTrigB.hitTestObject(point_b) && point_b_mc.visible == true && ((fieldAOn == true) || (fieldBOn == true) || (fieldCOn == true) || (fieldDOn == true)) && myClipReady == true && (shootA == true || shootB == true || shootC == true || shootD == true)) 
				|| (homeBtnTrigC.hitTestObject(point_c) && point_c_mc.visible == true && ((fieldAOn == true) || (fieldBOn == true) || (fieldCOn == true) || (fieldDOn == true)) && myClipReady == true && (shootA == true || shootB == true || shootC == true || shootD == true)) 
				|| (homeBtnTrigD.hitTestObject(point_d) && point_d_mc.visible == true && ((fieldAOn == true) || (fieldBOn == true) || (fieldCOn == true) || (fieldDOn == true)) && myClipReady == true && (shootA == true || shootB == true || shootC == true || shootD == true))) {
					for (theV_72;theV_72 < 1; theV_72++){
						trace("[ HIT HOME ALL]");
						myClipReady = false;
						Tweener.addTween(homeBtn.HomeBtnContent, {time:1.5,_Glow_alpha:1,_Glow_blurX:9,_Glow_blurY:9,_Glow_color:0xffffff,_Glow_strength:20,_Glow_inner:true,transition:"easeOutStrong"});
						homeDelay();
						my_Song.play();
					}
				}
			}
		}
		//// VIDEO BUTTONS EXE
		public function _vidBtn_Exe(e:Event):void
		{
			if(vidBtn_A.hitTestObject(point_c) && point_c_mc.visible==true){
				if(theV_31==0){
					Tweener.addTween(vidBtn_A.vidGallBtn_1, {alpha:0.9, time:1, transition:"easeOutStrong"});
					theV_31=1;
					theV_32=1
					my_Song.play();
					Tweener.addTween(vidBtn_A.vidGallBtn_1, {time:0,delay:1,onComplete:function(){											
											vidBtns_On = false;
											Tweener.addTween(vidBtn_A.vidGallBtn_1, {alpha:0, time:0});
											Tweener.addTween(vidBtn_A.vidGallFrame_1, {alpha:0, time:0});
											Tweener.addTween(vidBtn_B.vidGallBtn_2, {alpha:0, time:0});
											Tweener.addTween(vidBtn_B.vidGallFrame_2, {alpha:0, time:0});
											swfFileLocation = "videogallery.swf";
											loadExternalSwf();
											vidBtn_Box.removeEventListener(Event.ENTER_FRAME, _vidBtn_Exe);
											}});
				}
			} 
			if(vidBtn_B.hitTestObject(point_c) && point_c_mc.visible==true){
				if(theV_32==0){
					Tweener.addTween(vidBtn_B.vidGallBtn_2, {alpha:0.9, time:1, transition:"easeOutStrong"});
					theV_32=1;
					theV_31=1;
					my_Song.play();
					Tweener.addTween(vidBtn_B.vidGallBtn_2, {time:0,delay:1,onComplete:function(){
											vidBtns_On = false;
											Tweener.addTween(vidBtn_A.vidGallBtn_1, {alpha:0, time:0});
											Tweener.addTween(vidBtn_A.vidGallFrame_1, {alpha:0, time:0});
											Tweener.addTween(vidBtn_B.vidGallBtn_2, {alpha:0, time:0});
											Tweener.addTween(vidBtn_B.vidGallFrame_2, {alpha:0, time:0});
											swfFileLocation = "arvideochannel.swf";
											loadExternalSwf();
											vidBtn_Box.removeEventListener(Event.ENTER_FRAME, _vidBtn_Exe);
											}});
				}
			} 
		}
		private function loadExternalSwf():void
		{
			externalSwfLoader.load(new URLRequest(swfFileLocation));
			createSwfRequest();
		}
		private function createSwfRequest():void
		{
			externalSwfLoader.contentLoaderInfo.addEventListener(Event.OPEN, preparePreloader);
			externalSwfLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loadSwfProgress);	
			externalSwfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, createSwfObjects);
			externalSwfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, finishPreloader);
			externalSwfLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, swfIoErrorEventHandler);
			return;
		}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		//// PRELOADER
		private function preparePreloader(evt:Event):void
		{
			externalSwfLoader.contentLoaderInfo.removeEventListener(Event.OPEN, preparePreloader);
			page_preloader_mc.visible = true;
			page_preloader_mc.alpha = 0;
			return;
		}
		private function loadSwfProgress(evt:ProgressEvent):void
		{
			var loc1:*=NaN;
			page_preloader_mc.alpha = 1;
			loc1 = Math.round(evt.bytesLoaded / evt.bytesTotal * stage.stageWidth);
			page_preloader_mc.width = loc1;
			page_preloader_mc.x = 0;
			return;
		}		
		private function finishPreloader(evt:flash.events.Event):void
		{
			externalSwfLoader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, loadSwfProgress);
			externalSwfLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, finishPreloader);
			Tweener.addTween(page_preloader_mc, {"alpha":0, "time":1, "transition":"easeOutExpo"});
			return;
		}
		private function swfIoErrorEventHandler(evt:IOErrorEvent):void
		{
			var evt:IOErrorEvent;		
			var loc1:*;
			evt = evt;
			if (externalSwfLoader != null) 
			{
				try 
				{
					externalSwfLoader.unload();
				}
				catch (evt:Error)
				{
				};
				externalSwfLoader = null;
			}
			return;
		}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		private function createSwfObjects(evt:Event):void
		{
			externalSwfLoader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, loadSwfProgress);
			externalSwfLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, createSwfObjects);
			var loaderInfo:LoaderInfo = evt.target as LoaderInfo;
			swfComObject = loaderInfo.content;
//// DETECT SWF AND DEFINE ACTIONS
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////			
			if (swfFileLocation == "songs_n_lyrics.swf"){
				myClip1 = evt.target.content;
				myClip1.x = -(800/2);
				myClip1.y = -(595/2);
				field_a.addChild(myClip1);
				myClipReady = true;
				myClip1.addEventListener(Event.ENTER_FRAME, SLFunctionality);
			}
			if (swfFileLocation == "angelcome.swf"){
				myClip2 = evt.target.content;
				myClip2.x = -(980/2);
				myClip2.y = -(300/2);
				field_b.addChild(myClip2);
				myClipReady = true;
				myClip2.addEventListener(Event.ENTER_FRAME, ACFunctionality);
			}
			if (swfFileLocation == "videogallery.swf"){
				myClip = evt.target.content;
				myClip.x = -(710/2);
				myClip.y = -(504/2);
				field_c.addChild(myClip);
				myClipReady = true;
				myClip.addEventListener(Event.ENTER_FRAME, VidFunctionality);
				vidAActive = true;
			}
			if (swfFileLocation == "arvideochannel.swf"){
				myClip = evt.target.content;
				myClip.x = -(710/2);
				myClip.y = -(504/2);
				field_c.addChild(myClip);
				myClipReady = true;
				myClip.addEventListener(Event.ENTER_FRAME, VidFunctionality);
				vidBActive = true;
			}
			if (swfFileLocation == "gallery.swf"){
				myClip4 = evt.target.content;
				myClip4.x = -(760/2);
				myClip4.y = -(500/2);
				field_d.addChild(myClip4);
				myClipReady = true;
				myClip4.addEventListener(Event.ENTER_FRAME, GallFunctionality);
			}
			if (swfFileLocation == "connector.swf"){
				connectorSWF = evt.target.content;
				stage.addChild(connectorSWF);
				initAR();
				initItems();
				FSOn();
			}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////		
			Tweener.addTween(page_preloader_mc, {"alpha":0, "time":1, "transition":"easeOutExpo"});
			return;
		}
//// VIDEO GALLERY
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////		
		private function VidFunctionality(evt:Event):void
		{		
			if(theV_30==0){
				myClip.addEventListener(Event.ENTER_FRAME, _controlVid);
				theV_30=1;
			}
		}
		private function _controlVid(evt:Event):void {
			if(myClip.nextVid_mc.hitTestObject(point_c) && point_c_mc.visible==true){
				if(theV_13==0){
					trace("nextVid_mc");
					Tweener.addTween(loadSignC, {time:0.2,onComplete:function(){loadSignC.visible = true;}});
					myClip.nextOnClick();
					theV_13=1;
					my_Song.play();
					Tweener.addTween(myClip, {time:0,delay:2.5,onComplete:function(){theV_13=0;trace("theV_13=0 again"); loadSignC.visible = false;}});
				}
			}
			if(myClip.prevVid_mc.hitTestObject(point_c) && point_c_mc.visible==true){
				if(theV_13==0){
					trace("prevVid_mc");
					Tweener.addTween(loadSignC, {time:0.2,onComplete:function(){loadSignC.visible = true;}});
					myClip.prevOnClick();
					theV_13=1;
					my_Song.play();
					Tweener.addTween(myClip, {time:0,delay:2.5,onComplete:function(){theV_13=0;trace("theV_13=0 again"); loadSignC.visible = false;}});
				}
			}
			if(myClip.play_pause_mc.hitTestObject(point_c) && point_c_mc.visible==true){
				if(theV_13==0){
					trace("play_pause_mc");
					Tweener.addTween(loadSignC, {time:0.2,onComplete:function(){loadSignC.visible = true;}});
					myClip.playPauseVideo();
					theV_13=1;
					my_Song.play();
					Tweener.addTween(myClip, {time:0,delay:2.5,onComplete:function(){theV_13=0;trace("theV_13=0 again"); loadSignC.visible = false;}});
				}
			}
			if(myClip.video_main_mc.play_pause_mc.hitTestObject(point_c) && point_c_mc.visible==true){
				if(theV_13==0){
					trace("video_main_mc.play_pause_mc");
					Tweener.addTween(loadSignC, {time:0.2,onComplete:function(){loadSignC.visible = true;}});
					myClip.playPauseVideo();
					theV_13=1;
					my_Song.play();
					Tweener.addTween(myClip, {time:0,delay:2.5,onComplete:function(){theV_13=0;trace("theV_13=0 again"); loadSignC.visible = false;}});
				}
			}
		}
//// SONGS'N'LYRICS
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////		
		private function SLFunctionality(evt:Event):void
		{		
			if(theV_40==0){
				myClip1.addEventListener(Event.ENTER_FRAME, _controlSL);
				theV_40=1;
			}
		}
		private function _controlSL(evt:Event):void {
			if(myClip1.prevSong_mc.hitTestObject(point_a) && point_a_mc.visible==true){  
				if(theV_41==0){
					trace("prevSong_mc");
					Tweener.addTween(loadSignA, {time:0.2,onComplete:function(){loadSignA.visible = true;}});
					myClip1.goToPrevTextItem();
					theV_41=1;
					my_Song.play();
					Tweener.addTween(myClip1, {time:0,delay:2.5,onComplete:function(){theV_41=0;trace("theV_41=0 again"); loadSignA.visible = false;}});
				}
			}
			if(myClip1.nextSong_mc.hitTestObject(point_a) && point_a_mc.visible==true){  
				if(theV_41==0){
					trace("nextSong_mc");
					Tweener.addTween(loadSignA, {time:0.2,onComplete:function(){loadSignA.visible = true;}});
					myClip1.goToNextTextItem();
					theV_41=1;
					my_Song.play();
					Tweener.addTween(myClip1, {time:0,delay:2.5,onComplete:function(){theV_41=0;trace("theV_41=0 again"); loadSignA.visible = false;}});
				}
			}
			if(myClip1.audioplayer.entire_player_mc.play_mc.hitTestObject(point_a) && point_a_mc.visible==true){  
				if(theV_41==0){
					trace("audioplayer.entire_player_mc.play_mc");
					Tweener.addTween(loadSignA, {time:0.2,onComplete:function(){loadSignA.visible = true;}});
					myClip1.audioplayer.playBtnPressed();
					theV_41=1;
					my_Song.play();
					Tweener.addTween(myClip1, {time:0,delay:2.5,onComplete:function(){theV_41=0;trace("theV_41=0 again"); loadSignA.visible = false;}});
				}
			}
			if(myClip1.audioplayer.entire_player_mc.pause_mc.hitTestObject(point_a) && point_a_mc.visible==true){
				if(theV_41==0){
					trace("audioplayer.entire_player_mc.pause_mc");
					Tweener.addTween(loadSignA, {time:0.2,onComplete:function(){loadSignA.visible = true;}});
					myClip1.audioplayer.pauseBtnPressed();
					theV_41=1;
					my_Song.play();
					Tweener.addTween(myClip1, {time:0,delay:2.5,onComplete:function(){theV_41=0;trace("theV_41=0 again"); loadSignA.visible = false;}});
				}
			}
			if(myClip1.audioplayer.entire_player_mc.stop_mc.hitTestObject(point_a) && point_a_mc.visible==true){
				if(theV_41==0){
					trace("audioplayer.entire_player_mc.stop_mc");
					Tweener.addTween(loadSignA, {time:0.2,onComplete:function(){loadSignA.visible = true;}});
					myClip1.audioplayer.stopBtnPressed();
					theV_41=1;
					my_Song.play();
					Tweener.addTween(myClip1, {time:0,delay:2.5,onComplete:function(){theV_41=0;trace("theV_41=0 again"); loadSignA.visible = false;}});
				}
			}
			if(myClip1.audioplayer.entire_player_mc.volume_up_mc.hitTestObject(point_a) && point_a_mc.visible==true){
				if(theV_41==0){
					trace("audioplayer.entire_player_mc.volume_up_mc");
					Tweener.addTween(loadSignA, {time:0.2,onComplete:function(){loadSignA.visible = true;}});
					myClip1.audioplayer.volUpBtnPressed();
					theV_41=1;
					my_Song.play();
					Tweener.addTween(myClip1, {time:0,delay:2.5,onComplete:function(){theV_41=0;trace("theV_41=0 again"); loadSignA.visible = false;}});
				}
			}
			if(myClip1.audioplayer.entire_player_mc.volume_down_mc.hitTestObject(point_a) && point_a_mc.visible==true){
				if(theV_41==0){
					trace("audioplayer.entire_player_mc.volume_down_mc");
					Tweener.addTween(loadSignA, {time:0.2,onComplete:function(){loadSignA.visible = true;}});
					myClip1.audioplayer.volDownBtnPressed();
					theV_41=1;
					my_Song.play();
					Tweener.addTween(myClip1, {time:0,delay:2.5,onComplete:function(){theV_41=0;trace("theV_41=0 again"); loadSignA.visible = false;}});
				}
			}
			//// SCROLL
			//// I
			if(myClip1.scroll_up_mc_1.hitTestObject(point_a) && point_a_mc.visible==true){
				if(theV_41==0){ theV_41=1; Tweener.addTween(loadSignA, {time:0.2,onComplete:function(){loadSignA.visible = true;}}); my_Song.play(); myClip1.scr1Up(); Tweener.addTween(myClip1, {time:0,delay:2.5,onComplete:function(){theV_41=0; loadSignA.visible = false;}}); }
			}
			if(myClip1.scroll_down_mc_1.hitTestObject(point_a) && point_a_mc.visible==true){
				if(theV_41==0){ theV_41=1; Tweener.addTween(loadSignA, {time:0.2,onComplete:function(){loadSignA.visible = true;}}); my_Song.play(); myClip1.scr1Down(); Tweener.addTween(myClip1, {time:0,delay:2.5,onComplete:function(){theV_41=0; loadSignA.visible = false;}}); }
			}
			//// II
			if(myClip1.scroll_up_mc_2.hitTestObject(point_a) && point_a_mc.visible==true){
				if(theV_41==0){ theV_41=1; Tweener.addTween(loadSignA, {time:0.2,onComplete:function(){loadSignA.visible = true;}}); my_Song.play(); myClip1.scr2Up(); Tweener.addTween(myClip1, {time:0,delay:2.5,onComplete:function(){theV_41=0; loadSignA.visible = false;}}); }
			}
			if(myClip1.scroll_down_mc_2.hitTestObject(point_a) && point_a_mc.visible==true){
				if(theV_41==0){ theV_41=1; Tweener.addTween(loadSignA, {time:0.2,onComplete:function(){loadSignA.visible = true;}}); my_Song.play(); myClip1.scr2Down(); Tweener.addTween(myClip1, {time:0,delay:2.5,onComplete:function(){theV_41=0; loadSignA.visible = false;}}); }
			}
			//// III
			if(myClip1.scroll_up_mc_3.hitTestObject(point_a) && point_a_mc.visible==true){
				if(theV_41==0){ theV_41=1; Tweener.addTween(loadSignA, {time:0.2,onComplete:function(){loadSignA.visible = true;}}); my_Song.play(); myClip1.scr3Up(); Tweener.addTween(myClip1, {time:0,delay:2.5,onComplete:function(){theV_41=0; loadSignA.visible = false;}}); }
			}
			if(myClip1.scroll_down_mc_3.hitTestObject(point_a) && point_a_mc.visible==true){
				if(theV_41==0){ theV_41=1; Tweener.addTween(loadSignA, {time:0.2,onComplete:function(){loadSignA.visible = true;}}); my_Song.play(); myClip1.scr3Down(); Tweener.addTween(myClip1, {time:0,delay:2.5,onComplete:function(){theV_41=0;loadSignA.visible = false;}}); }
			}
			//// IV
			if(myClip1.scroll_up_mc_4.hitTestObject(point_a) && point_a_mc.visible==true){
				if(theV_41==0){ theV_41=1; Tweener.addTween(loadSignA, {time:0.2,onComplete:function(){loadSignA.visible = true;}}); my_Song.play(); myClip1.scr4Up(); Tweener.addTween(myClip1, {time:0,delay:2.5,onComplete:function(){theV_41=0; loadSignA.visible = false;}}); }
			}
			if(myClip1.scroll_down_mc_4.hitTestObject(point_a) && point_a_mc.visible==true){
				if(theV_41==0){ theV_41=1; Tweener.addTween(loadSignA, {time:0.2,onComplete:function(){loadSignA.visible = true;}}); my_Song.play(); myClip1.scr4Down(); Tweener.addTween(myClip1, {time:0,delay:2.5,onComplete:function(){theV_41=0; loadSignA.visible = false;}}); }
			}
			//// V
			if(myClip1.scroll_up_mc_5.hitTestObject(point_a) && point_a_mc.visible==true){
				if(theV_41==0){ theV_41=1; Tweener.addTween(loadSignA, {time:0.2,onComplete:function(){loadSignA.visible = true;}}); my_Song.play(); myClip1.scr5Up(); Tweener.addTween(myClip1, {time:0,delay:2.5,onComplete:function(){theV_41=0; loadSignA.visible = false;}}); }
			}
			if(myClip1.scroll_down_mc_5.hitTestObject(point_a) && point_a_mc.visible==true){
				if(theV_41==0){ theV_41=1; Tweener.addTween(loadSignA, {time:0.2,onComplete:function(){loadSignA.visible = true;}}); my_Song.play(); myClip1.scr5Down(); Tweener.addTween(myClip1, {time:0,delay:2.5,onComplete:function(){theV_41=0; loadSignA.visible = false;}}); }
			}
			//// VI
			if(myClip1.scroll_up_mc_6.hitTestObject(point_a) && point_a_mc.visible==true){
				if(theV_41==0){ theV_41=1; Tweener.addTween(loadSignA, {time:0.2,onComplete:function(){loadSignA.visible = true;}}); my_Song.play(); myClip1.scr6Up(); Tweener.addTween(myClip1, {time:0,delay:2.5,onComplete:function(){theV_41=0; loadSignA.visible = false;}}); }
			}
			if(myClip1.scroll_down_mc_6.hitTestObject(point_a) && point_a_mc.visible==true){
				if(theV_41==0){ theV_41=1; Tweener.addTween(loadSignA, {time:0.2,onComplete:function(){loadSignA.visible = true;}}); my_Song.play(); myClip1.scr6Down(); Tweener.addTween(myClip1, {time:0,delay:2.5,onComplete:function(){theV_41=0; loadSignA.visible = false;}}); }
			}
			//// VII
			if(myClip1.scroll_up_mc_7.hitTestObject(point_a) && point_a_mc.visible==true){
				if(theV_41==0){ theV_41=1; Tweener.addTween(loadSignA, {time:0.2,onComplete:function(){loadSignA.visible = true;}}); my_Song.play(); myClip1.scr7Up(); Tweener.addTween(myClip1, {time:0,delay:2.5,onComplete:function(){theV_41=0; loadSignA.visible = false;}}); }
			}
			if(myClip1.scroll_down_mc_7.hitTestObject(point_a) && point_a_mc.visible==true){
				if(theV_41==0){ theV_41=1; Tweener.addTween(loadSignA, {time:0.2,onComplete:function(){loadSignA.visible = true;}}); my_Song.play(); myClip1.scr7Down(); Tweener.addTween(myClip1, {time:0,delay:2.5,onComplete:function(){theV_41=0; loadSignA.visible = false;}}); }
			}
		}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////		
//// GALLERY
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////		
		private function GallFunctionality(evt:Event):void
		{		
			if(theV_50==0){
				myClip4.addEventListener(Event.ENTER_FRAME, _controlGall);
				theV_50=1;
			}
		}
		private function _controlGall(evt:Event):void {
			if(myClip4.control_box.next_mc.hitTestObject(point_d) && point_d_mc.visible==true){
				if(theV_51==0){
					trace("control_box.next_mc");
					Tweener.addTween(loadSignD, {time:0.2,onComplete:function(){loadSignD.visible = true;}});
					myClip4.navigateN();
					theV_51=1;
					my_Song.play();
					Tweener.addTween(myClip4, {time:0,delay:2.5,onComplete:function(){theV_51=0;trace("theV_51=0 again"); loadSignD.visible = false;}});
				}
			}
			if(myClip4.control_box.prev_mc.hitTestObject(point_d) && point_d_mc.visible==true){  
				if(theV_51==0){
					trace("control_box.prev_mc");
					Tweener.addTween(loadSignD, {time:0.2,onComplete:function(){loadSignD.visible = true;}});
					myClip4.navigateP();
					theV_51=1;
					my_Song.play();
					Tweener.addTween(myClip4, {time:0,delay:2.5,onComplete:function(){theV_51=0;trace("theV_51=0 again"); loadSignD.visible = false;}});
				}
			}			
		}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////		
//// ANGEL COME MUSIC VIDEO
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////		
		private function ACFunctionality(evt:Event):void
		{		
			if(theV_55==0){
				myClip2.addEventListener(Event.ENTER_FRAME, _controlAC);
				theV_55=1;
			}
		}
		private function _controlAC(evt:Event):void {
			if(myClip2.fr_mc.hitTestObject(point_b) && point_b_mc.visible==true){ 
				if(theV_56==0){
					trace("fr_mc");
					if(fr_mcActive == false){ Tweener.addTween(loadSignB, {time:0.2,onComplete:function(){loadSignB.visible = true;}}); }
					fr_mcActive = true;
					nt_mcActive = false;
					pt_mcActive = false;
					bs_mcActive = false;
					nS_mcsActive = false;
					myClip2.onFrOver();
					theV_56=1;
					Tweener.addTween(myClip2, {time:0,delay:1.5,onComplete:function(){theV_56=0;trace("theV_56=0 again"); loadSignB.visible = false;}});
				}
			}
			if((myClip2.neutralStageT.hitTestObject(point_b) && point_b_mc.visible==true) || (myClip2.neutralStageB.hitTestObject(point_b) && point_b_mc.visible==true) || (myClip2.neutralStageL.hitTestObject(point_b) && point_b_mc.visible==true) || (myClip2.neutralStageR.hitTestObject(point_b) && point_b_mc.visible==true)){ 
				if(theV_56==0){
					trace("neutralStage_mcs");
					if(nS_mcsActive == false){ Tweener.addTween(loadSignB, {time:0.2,onComplete:function(){loadSignB.visible = true;}}); }
					fr_mcActive = false;
					nt_mcActive = false;
					pt_mcActive = false;
					bs_mcActive = false;
					nS_mcsActive = true;
					myClip2.onNsOver();
					theV_56=1;
					Tweener.addTween(myClip2, {time:0,delay:1.5,onComplete:function(){theV_56=0;trace("theV_56=0 again"); loadSignB.visible = false;}});
				}
			}
			if(myClip2.nt_mc.hitTestObject(point_b) && point_b_mc.visible==true){ 
				if(theV_56==0){
					trace("nt_mc");
					if(nt_mcActive == false){ Tweener.addTween(loadSignB, {time:0.2,onComplete:function(){loadSignB.visible = true;}}); }
					fr_mcActive = false;
					nt_mcActive = true;
					pt_mcActive = false;
					bs_mcActive = false;
					nS_mcsActive = false;
					myClip2.onNtOver();
					theV_56=1;
					Tweener.addTween(myClip2, {time:0,delay:1.5,onComplete:function(){theV_56=0;trace("theV_56=0 again"); loadSignB.visible = false;}});
				}
			}
			if(myClip2.pt_mc.hitTestObject(point_b) && point_b_mc.visible==true){ 
				if(theV_56==0){
					trace("pt_mc");
					if(pt_mcActive == false){ Tweener.addTween(loadSignB, {time:0.2,onComplete:function(){loadSignB.visible = true;}}); }
					fr_mcActive = false;
					nt_mcActive = false;
					pt_mcActive = true;
					bs_mcActive = false;
					nS_mcsActive = false;
					myClip2.onPtOver();
					theV_56=1;
					Tweener.addTween(myClip2, {time:0,delay:1.5,onComplete:function(){theV_56=0;trace("theV_56=0 again"); loadSignB.visible = false;}});
				}
			}
			if(myClip2.bs_mc.hitTestObject(point_b) && point_b_mc.visible==true){ 
				if(theV_56==0){
					trace("bs_mc");
					if(bs_mcActive == false){ Tweener.addTween(loadSignB, {time:0.2,onComplete:function(){loadSignB.visible = true;}}); }
					fr_mcActive = false;
					nt_mcActive = false;
					pt_mcActive = false;
					bs_mcActive = true;
					nS_mcsActive = false;
					myClip2.onBsOver();
					theV_56=1;
					Tweener.addTween(myClip2, {time:0,delay:1.5,onComplete:function(){theV_56=0;trace("theV_56=0 again"); loadSignB.visible = false;}});
				}
			}
		}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////		
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		private function scaleProportional():void {
			if ((stage.stageHeight / stage.stageWidth) < picHeight) {
				_baseContainer.width = stage.stageWidth;
				_baseContainer.height = picHeight * _baseContainer.width;
				screenBlende.width = stage.stageWidth;
				screenBlende.height = picHeight * screenBlende.width;
			} else {
				_baseContainer.height = stage.stageHeight;
				_baseContainer.width = picWidth * _baseContainer.height;
				screenBlende.height = stage.stageHeight;
				screenBlende.width = picWidth * screenBlende.height;
			};	
		}
		private function centerPic():void {
			_baseContainer.x = stage.stageWidth / 2 - _baseContainer.width / 2;
			_baseContainer.y = stage.stageHeight / 2 - _baseContainer.height / 2;
			screenBlende.x = stage.stageWidth / 2 - screenBlende.width / 2;
			screenBlende.y = stage.stageHeight / 2 - screenBlende.height / 2;
			cornerTL.x = cornerTL.width/2;
			cornerTL.y = cornerTL.height/2;
			cornerTR.x = stage.stageWidth - cornerTR.width/2;
			cornerTR.y = cornerTR.height/2;
			cornerBL.x = cornerBL.width/2;
			cornerBL.y = stage.stageHeight - cornerBL.height/2;
			cornerBR.x = stage.stageWidth - cornerBR.width/2;
			cornerBR.y = stage.stageHeight - cornerBR.height/2;
			creditsPanel.x = stage.stageWidth / 2;
			creditsPanel.y = stage.stageHeight-150;
			Tweener.addTween(homeBtn, {x:0, y:stage.stageHeight/2, time:1.5, transition:"easeOutStrong"});
			Tweener.addTween(trig_a_mc, {x:trig_a_mc.width/2, y:trig_a_mc.height/2, time:1.5, transition:"easeOutStrong"});
			Tweener.addTween(trig_b_mc, {x:stage.stageWidth - trig_b_mc.width/2, y:trig_b_mc.height/2, time:1.5, transition:"easeOutStrong"});
			Tweener.addTween(trig_c_mc, {x:trig_c_mc.width/2, y:stage.stageHeight - trig_c_mc.height/2, time:1.5, transition:"easeOutStrong"});
			Tweener.addTween(trig_d_mc, {x:stage.stageWidth - trig_d_mc.width/2, y:stage.stageHeight - trig_d_mc.height/2, time:1.5, transition:"easeOutStrong"});
			if(fieldAActive==true){
				Tweener.addTween(field_a, {x:stage.stageWidth/2, y:stage.stageHeight/2, time:1.5, transition:"easeOutStrong"});
			}
			if(fieldBActive==true){
				Tweener.addTween(field_b, {x:stage.stageWidth/2, y:stage.stageHeight/2, time:1.5, transition:"easeOutStrong"});
			}
			if(fieldCActive==true){
				Tweener.addTween(field_c, {x:stage.stageWidth/2, y:stage.stageHeight/2, time:1.5, transition:"easeOutStrong"});
			}
			if(fieldDActive==true){
				Tweener.addTween(field_d, {x:stage.stageWidth/2, y:stage.stageHeight/2, time:1.5, transition:"easeOutStrong"});
			}
		}
		private function resizeListener(e:Event):void {
			scaleProportional();
			centerPic();
		}
		//// MIRROR
		public function set mirror(value:Boolean):void {
			if (value) {
				_base.scaleX = -1;
				_base.x = 640;
			} else {
				_base.scaleX = 1;
				_base.x = 0;
			}
		}
		public function get mirror():Boolean {
		return _base.scaleX < 0;
		}
	}
}
import org.libspark.flartoolkit.core.transmat.FLARTransMatResult;
internal class MarkerData
{
	public var confidence:Number;
	public var markerIndex:int;
	public var resultMat:FLARTransMatResult;
	public var isDetect:Boolean = false;
	public var isPrevDetect:Boolean = false;
	public function MarkerData(_markerIndex:int)
	{
		this.markerIndex = _markerIndex;
		this.resultMat = new FLARTransMatResult();
	}
}
import flash.events.Event;
class MarkerEvent extends Event {
	public static const MARKER_1_ADDED : String= "marker1Added";
	public static const MARKER_1_REMOVED : String= "marker1Removed";
	public static const MARKER_2_ADDED : String= "marker2Added";
	public static const MARKER_2_REMOVED : String= "marker2Removed";
	public static const MARKER_3_ADDED : String= "marker3Added";
	public static const MARKER_3_REMOVED : String= "marker3Removed";
	public static const MARKER_4_ADDED : String= "marker4Added";
	public static const MARKER_4_REMOVED : String= "marker4Removed";
	public function MarkerEvent(type : String, bubbles : Boolean= false, cancelable : Boolean= false) {
	super( type, bubbles, cancelable );
	}
}